Dependency injection angularjs has a built in

This preview shows page 5 - 16 out of 43 pages.

Dependency Injection: AngularJS has a built-in dependency injection subsystem that helps the developer to create, understand, and test the applications easily. 5
Image of page 5
Concepts 6
Image of page 6
Advantages of AngularJS It provides the capability to create Single Page Application in a very clean and maintainable way. It provides data binding capability to HTML. Thus, it gives user a rich and responsive experience. AngularJS code is unit testable. AngularJS uses dependency injection and make use of separation of concerns. AngularJS provides reusable components 7
Image of page 7
Disadvantages of AngularJS Not secure : Being JavaScript only framework, application written in AngularJS are not safe. Server side authentication and authorization is must to keep an application secure. Not degradable: If the user of your application disables JavaScript, then nothing would be visible, except the basic page. 8
Image of page 8
ENVIRONMENT how to set up AngularJS library to be used in web application development. When you open the link , you will see there are two options to download AngularJS library: View on GitHub – By clicking on this button, you are diverted to GitHub and get all the latest scripts.  Download – By clicking on this button, a screen you get to see a dialog box shown as: 9
Image of page 9
10
Image of page 10
This screen offers various options for selecting Angular JS as follows: Downloading and hosting files locally There are two different options : Legacy and Latest. The names themselves are self- descriptive. The Legacy has version less than 1.2.x and the Latest come with version 1.3.x. We can also go with the minimized, uncompressed, or zipped version. CDN access: You also have access to a CDN. The CDN gives you access to regional data centers. In this case, the Google host. The CDN transfers the responsibility of hosting files from your own servers to a series of external ones. It also offers an advantage that if the visitor of your web page has already downloaded a copy of AngularJS from the same CDN, there is no need to re-download it. 11
Image of page 11
Example Let us create an HTML file myfirstexample.html shown as below: <!doctype html> <html> <head> <script src="- beta.17/angular.min.js"></script> </head> <body ng-app="myapp"> <div ng-controller="HelloController" > <h2>Welcome {{helloTo.title}} to the world of Tutorialspoint!</h2> </div> <script> angular.module("myapp", []) .controller("HelloController", function($scope) { $scope.helloTo = {}; $scope.helloTo.title = "AngularJS"; }); </script> </body> </html> 12
Image of page 12
Include AngularJS We include the AngularJS JavaScript file in the HTML page so that we can use it: <head> <script src=". min.js"></script> </head> 13
Image of page 13
Point to AngularJS app Next, it is required to tell which part of HTML contains the AngularJS app. You can do this by adding the ng-app attribute to the root HTML element of the AngularJS app. You can either add it to the html element or the body element as shown below: <body ng-app="myapp"> </body> 14
Image of page 14
View The view is this part: <div ng-controller="HelloController" > <h2>Welcome {{helloTo.title}} to the world of Tutorialspoint!</h2>
Image of page 15
Image of page 16

You've reached the end of your free preview.

Want to read all 43 pages?

  • Fall '19
  • AngularJS

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture