Features of AngularJS

an2

Model:  It’s a simple JavaScript object which used to transfer the data between the controller and view. This means our data lives in a model

View: Our HTML lives as a tiny template to be rendered as a View, and we use a Controller to connect the two, driving Model and View value changes.

Controller:

Modules: Every application in Angular is created using modules. A module can have dependencies of other modules, or be a single module all by itself. These modules act as containers for different sections of an application, making code more reusable and testable. To create a module, we hit the global angular Object, the framework’s namespace, and use the module method.

  • Setters: means we are creating a new module, while creating it we can import the other modules as well. In the [] we have to add the other modules.

Angular.module(‘sampleApp’,[])

  • Getters: For creating the directives, controllers etc… We have to use the existing modules.

Angular.module(‘sampleApp’)

HTML Bootstrapping: To declare where our application sits in the DOM, typically the <html> element, we need to bind an ng-app attribute with the value of our module. This tells Angular where to bootstrap our application.

$Scope vs $rootScope: $scope is limited to that a particular controller, While rootscope will be accessed to its child and parent controllers. Parent $rootScope value will be updated with the child $rootScope value.

Controllers: An Angular Controller allows us to interact with a View and Model, it’s the place where presentational logic can take place to keep the UI bindings in sync with the Model. A Controller’s purpose is to drive Model and View changes, in Angular it’s a meeting place between our business logic and our presentational logic.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s