How do I “think in AngularJS” if I have a jQuery background?

Discussion in 'JavaScript' started by Robin Mohammad, Sep 26, 2014.

  1. #1
    Suppose I'm familiar with developing client-side applications in jQuery, but now I'd like to start using AngularJS. Can you describe the paradigm shift that is necessary? Here are a few questions that might help you frame an answer:

    How do I architect and design client-side web applications differently? What is the biggest difference?
    What should I stop doing/using; what should I start doing/using instead?
    Are there any server-side considerations/restrictions?
    I'm not looking for a detailed comparison between jQuery and AngularJS.
     
    Robin Mohammad, Sep 26, 2014 IP
  2. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #2
    My advice -- don't... Gooftard re-re mouth-breathing framework idiocy like jQuery and AngularJS are nothing more than convoluted code bloat that piss all over every project they are used on.

    Ever consider, oh I don't know... just using the actual underlying language? Not pissing all over websites making them slower and harder to use with scripttardery for nothing?
     
    deathshadow, Sep 27, 2014 IP
  3. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #3
    If you want to use stuff akin to Angular, I'd suggest having a look at Node.js - server-based javascript, usually quite speedy, easily scalable, easily modifiable, and easy to learn.
     
    PoPSiCLe, Sep 29, 2014 IP
  4. FDIM

    FDIM Member

    Messages:
    55
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #4
    I am not a pro with angular yet, but I successfully used it for a tool in the backend. Where I think its meant to be used for.
    -- How do I architect and design client-side web applications differently? What is the biggest difference?
    You should forget making templates in your app, whether is php, Razor, smarty,.... All you have to write is html with meta data that will be interpreted by angular. On the server side you should only care about serving main template/page and provide end points to get the data (You can put some of it in js file as services, and later on extend them to call backend if needed).

    -- What should I stop doing/using; what should I start doing/using instead?
    jQuery for starters :) Dive in into angular world, you should only care about application logic, not binding between particular html element and whatever you are doing.
    For example angular can toggle classes based on variables available in $scope. E.g. set $scope.loading = true; in js file when making ajax call and setting it back to false when its done. Add ng-class="{loading:MeWithProgressBar}" to some html element and see what happens. Class will be automatically added when scope is set to true and removed when its false.
    This is just a tip (very very tiny one) of the iceberg.

    -- Are there any server-side considerations/restrictions?
    Angular is only client side, as long as you can feed json data - you are good to go. Since you might be making more http requests, more robust server than apache with php would be better choice E.g. Node or IIS with .net mvc web api.

    Feel free to ask other questions if you have any :)
     
    FDIM, Nov 5, 2014 IP