As mentioned before frameworks provide a set of guidelines for building your application. Unlike libraries, that are sets of useful functionality that's contained in JavaScript files. AngularJS is an example of a framework that is used for building an application. When you choose a framework it may drive a portion of the application design because certain aspects of the framework needs to be in place for it to function properly.
Angular JS is commonly referred to as a Single Page Application (SPA). This is because the interaction and application logic all are on one single page. This single page also loads new data and content dynamically. This framework simplifies the process of building single page applications. Some of it's features include data -binding, client-side templating and AJAX wrappers for accessing data. AngularJS was designed to be testable end-to-end. It uses Dependency Injection to make replicating objects simple. It is also designed to encourage you to break the functionality of your application into several smaller, more testable parts.
AngularJS provides a set of constructs to reduce the amount of code and effort involved in making an application work properly. It's also Model-View-Controller (MVC) framework because it takes a modular approach to building your applications.
View: In this layer, we have the code related to what the user experiences, with pages and rules related to navigation.
Controller: This layer is the code that bridges between the navigation and the source of application data, represented by the model layer. Processing and business rules typically belong to this layer.
Model: In this layer is the code responsible for performing the persistence of the application data.
Each view is established in HTML. And these Views have a JavaScript controller module and model that drive the interaction. There is a JavaScript file that contains a controller. And in that file there's a specific constructor function that will be used to create the actual controller instance. The purpose of controllers is to create variables and add functionality to expressions and directives.
There is also an ng-controller directive to the HTML. This directive tells AngularJS that the new InvoiceController is responsible for the element with the directive and all of the element's children. The syntax InvoiceController tells AngularJS to instantiate the controller. And once it was instantiated save it in a variable invoice, that's in the current scope.
The possible occurrences of that directive are defined in the controller and added to the template using ng-repeat.
In AngularJS, a service is a function that 's available in your AngularJS application.
AngularJS has about 30 built-in services. For many services, it seems like you could use objects that are already in the DOM, even though you could it would have some limitations, at least for your AngularJS application.
AngularJS constantly supervises your application, and for it to handle changes and events properly, AngularJS prefers that you use the built in services. The $http service is one of the most common used services in AngularJS applications. The service makes a request to the server, and lets your application handle the response.
And so I conclude my post on Angular JS. With it having design flexibility and an easy to use structure, this single page applications model is a powerful tool that every web developer should have in his portfolio. Thanks to everyone who viewed this post. Till next time!
Top comments (0)