-->

Sunday 24 February 2013

begining AngularJS from Jquery


Assume you're acquainted with developing client-side programs in jQuery, however for one reason or still another you'd prefer to begin using AngularJS.jQuery is just a but a library ,AngularJs is just a lovely client-side construction, extremely testable, that includes a lot of great material such as MVC, addiction shot, information binding and much more.Then listed here for novices is recap on  angular JS MVC...

Crucial -> Declarative

In jQuery, selectors are accustomed to find DOM components and then bind/register event handlers for them. That (imperative) signal completes to update/change the DOM, when a meeting causes.
In Angular, you wish to consider opinions in the place of DOM components. Sights are (declarative) HTML which contain Angular directives. Directives put up the function handlers behind the scenes for us and provide us powerful databinding. Selectors are seldom employed, therefore the requirement for IDs (and some kinds of courses) is significantly reduced. Sights are associated with designs (via scopes). Sights really are a projection of the design. Occasions the sights that task these models upgrade "automatically.", and change models (i.e., information, range qualities)
In Angular, consider versions, in the place of jQuery-selected DOM components that maintain your computer data. Consider sights as forecasts of these versions, in the place of enrolling callbacks to control what the consumer sees.
Basically,With jQuery you inform the DOM what must occur, action by step,With AngularJs you explain what outcomes you need although not just how to get it done.
Separation of Concerns

Unobtrusive javascript is employed by javascript - conduct (JavaScript) is separated from the framework (HTML).
Angular employs directives and controllers (all of which could have their very own control, and/or gather and connecting capabilities) to get rid of conduct from the view/structure (HTML). Angular also offers providers and filters to greatly help separate/organize your application.


Here is a guiding principle when developing angular JS apps,
1.Think about your models. Create services or your own JavaScript objects for those models.
2.Think about how you want to present your models -- your views. Create HTML templates for each view, using the necessary directives to get dynamic databinding.
3.Attach a controller to each view (using ng-view and routing, or ng-controller). Have the controller find/get only whatever model data the view needs to do its job. Make controllers as thin as possible.

To master the full concept of  Angular js gothrough their awesome tutorial. 

0 comments:

Post a Comment