Week 09

Angular Modules

A module is mechanism to group components, directives, pipes and services that are related in such a way that can be combined with other modules to create an application.




Angular Forms


input, select, textarea are the ways for input data. A form is a collection of controls for the purpose of grouping related controls together.
Forms and controls provide validation services, so with that user can easily notify about invalid inputs before submitting the form.


ng-valid, ng-dirty , ng-touched classes are use to validate forms.


ng-include 


Fetches, compiles and include external HTML fragment

Ajax


$http is an AngularJs service for reading data from server.

The AngularJs $http service makes request to the server, and returns a response 

Examples for shortcut methods with Ajax

  • delete()
  • get()
  • head()
  • jsonp()
  • patch()
  • post()
  • put()

Views


AngularJs supports SPA via multiple views on a single page. To do this, AngularJs has provided ng-view and ng-template directives and $routerProvides services.

ng-view Directive

The ng-view directive simply creates a place holder where corresponding view can be placed based on the configuration. 

ng-template Directive 

The $routeProvider is a key service which sets the configuration of URLs, map them withe corresponding HTML page or ng-template, and attaches a controller with the same.

References: https://www.tutorialspoint.com/angularjs/angularjs_views.htm

 Scope


The $scope in AngularJs is a built-in object , which contains application data and methods.
Can create properties to a $scope object inside a controller function and assign a value or function to it.

The $scope transfer data from the controller to view and vise-versa

Reference: https://www.tutorialsteacher.com/angularjs/angularjs-scope

 Services 


Angular Js supports the concept of separation of concerns using service architecture. Services are Js functions, which are responsible to perform only specific task. This make them individual entities which are maintainable and testable.  The controllers and filters can call on requirement basis. Services are normally injected using dependency injection mechanism in Angular Js. 

Examples:
  • $http
  • $route
  • $window
  • $location

Reference: https://www.tutorialspoint.com/angularjs/angularjs_services.htm

 There are some links for sample projects did with Angular 8

https://github.com/Koshana/EcommerceAppDemo
https://github.com/Koshana/OnlineShopping
https://github.com/Koshana/RecipeBook

No comments:

Post a Comment

What is an Application Framework

What is an Application Framework? Simply application framework is an software framework use to implement standard structure of software....