Learn AngularJS
Angular js ng-app
- How to use Multiple ng-app within a page in AngularJS ?There are two ways to use a Multiple ng-app within a single page in AngularJS. One is the bootstrap method and the other is ngModules directive.
- Explain Bootstrapping in AngularJS ?After reading the HTML which is there within the root, Angular compiles it all into an internal representation. This process of reading and compiling is called as the bootstrapping process. When the code is written instead of the use of the ng-app directive, manual bootstrapping is done. It is actually the functional component that is there in the Core ng module which is actually used so that the user can start up an application hosted by Angular manually. Thereby it provides more control over the beginning of the application.
- Explain Directives in AngularJs ?AngularJS directives are extended HTML attributes with the ng prefix. The 3 main directives of angular js are: ng-app:- directive is used to flag the HTML element that Angular should consider to be the root element of our application. Angular uses the spinal-case for its custom attributes and camelCase for the corresponding directives which implement them. ng-model:- directive allows us to bind values of HTML controls (input, select, textarea) to application data. When using ngModel, not only change in the scope reflected in the view, but changes in the view are reflected back into the scope. ng-bind:- directive binds application modal data to the HTML view.
- Explain basic steps to set up an Angular JS app?Create an angular.module Assign a controller to the module Link your module to HTML with ng-app Link the controller to HTML with ng-controller directive
- Explain ng-app directive.ng-app directive defines and links an AngularJS application to HTML. It also indicate the start of the application.
- What is the use of filter in AngularJS?A filter is used to format the value of the expression to display the formatted output. AngularJS allows us to write our own filter. Filters can be added to expressions by using the pipe character |, followed by a filter. For example:
The name is {{ firstName | uppercase }}
- Is it possible to have two ng-app directives for a single Angular application?No, there can't be more than one ng-app directive for a single AngularJS application. The ng-app directive helps AngularJS application to make sure that it is the root element. In our HTML document, we can have only one ng-app directive. If there is more than one ng-app directive, then whichever appears first will be used.
- What are the different types of Directives in AngularJS?Directives are one of the most important components of AngularJS application. They are extended HTML attributes. In other words, directives are something that introduces new syntax. They are markers on the DOM element which provides some special behavior to DOM elements and tell AngularJS's HTML compiler to attach. Their are many built in directives such as ng-model, ng-repeat, ng-show, ng-bind etc. All these directives provide special behavior to DOM elements. For example, ng-show directive conditionally shows an element, ng-click directive adds click events to the element; ng-app directive initializes an AngularJS application, etc.
4iv>