There are several parts of AngularJS. build the innovative application, here are most of them
- View - The seeable space or formatted knowledge
- Controller - The business logic that drives the applying
- Scope - A context that holds knowledge models and functions.
- Directives - Extends HTML with custom parts and attributes
- Expressions - "}", wont to access scope models and functions
- Template - HTML and extra markup within the sort of directive and expressions
- Compiler - It parses the model and instantiates directives and expressions. In alternative words, the compilation in AngularJS suggests that attaching event listeners to the HTML part to create them interactive.
- Filter - It formats the worth of AN expression
- Data Binding - It synchronize knowledge between model and consider
- Dependency Injection - Creates and wires perform and objects
- Injector - it's an instrumentality for dependency injection
- Module - A instrumentality for various parts of the applying like filters, controllers, directives etc.
- Services - reusable business logic
- Directives are markers on a DOM part (HTML Tags, attribute, comment or CSS class) that tell compiler of AngularJS ($compile) to connect such behavior on these DOM parts or perhaps rework them and its children.
- ng-app – wont to attach the applying Module to the page or parent HTML part
- ng-controller – wont to attach a Controller perform
- ng-show / ng-hide - wont to show or hide a part supported the expression
- ng-repeat – wont to repeat a part for every item in AN Array
- ng-model – wont to bind the part to the property price of the Model.
- ng-init – wont to initialize our knowledge
- ng-change – wont to decision a perform once the part changes (input part within form) <form ng-change=”compute()”></form>
- ng-submit – won't to decision perform once the shape is submitted, it additionally mechanically prevents the shape doing its default post action to the server
- ng-<event name> (ng-click/ng-dblclick) - wont to decision a perform on these events
- ng-class – to line the category name, accepts the category name price as Boolean
- ng-src – wont to set the trail for the image
- ng-href – wont to set the target universal resource locator for the anchor tag
- ng-cloak - wont to hide parts until AngularJS bootstraps and finishes loading
AngularJs directives usually start with weight unit but we are able to additionally prefix it with “data” like “data-ng-app”. therefore rather than writing ng-app, we are able to write data-ng-app.
We shall study these directives one by one in their separate posts.
Normalization of Directive formats
Generally, directives are written dash delimited as AN attribute to the HTML part, but it also can be written in following ways in which
The module may be an instrumentality for various elements of AngularJS application like controllers, filters, services etc.
This is the place wherever we tend to write code for the Angular application
It makes our code a lot of reparable, testable and simply legible
This is additionally an area to outline dependencies in our app
Most applications have a main technique that gets instantiated once the application runs for the primary time and this technique instantiate totally different elements of the applying.
AngularJS does not have main technique, therefore it uses a module that specifies, however, AN application ought to be started. the advantages of this approach are following
We can produce reusable modules
Modules are loaded in any order
The unit takes a look at does not have to be compelled to load all the app, simply loading that specific module is enough to start out unit testing
It's simple to know
How to outline a module?
To create a module, we tend to use angular.module technique. It accepts 2 parameters
1st parameter - the name of the module
2nd parameter - the array of module names on that this module depends on
By: Mutasem Elayyoub