Angularjs MV* Framework and Components Goals

Angularjs MV* Framework and Components Goals

AngularJS MV* Framework and Components Goals ü Understanding MVC ü Understanding MV* structure of AngularJS ü Understanding Two-way dynamic binding ü Understanding Single-Page-Applications ü Understanding Declarative Approach of AngularJS ü Advantages of using AngularJS ü Component in AngularJS AngularJS Basics 2 MVC frameworks What is MVC In a typical MVC framework, developer has to code the update mechanism for view or model. However AngularJS framework automatically updates model (data) or view according to changes made in any one of them. AngularJS Basics 4 Problem of MVC MVC frameworks generally combines model with template and generate view. This approach has a major drawback when it comes to updating. This is One- way Binding AngularJS Basics 5 AngularJS AngularJS AngularJS is an open-source Javascript MVC (or better MV*) framework created by Google to build dynamic web applications with a proper architecture. It enhances the capabilities of HTML and lets you create Single Page dynamic web apps. The other popular JavaScript web frameworks are Backbone.js, Ember.js etc. AngularJS Basics 7 Single Page App (SPA) - Single page is loaded Static Part - All script resources are loaded initially - Partials are loaded depending on routing scheme - Data remains persistent until Dynamic Part reload http://www.myapplication.com/login http://www.myapplication.com/profile AngularJS Basics 8 Single Page App (SPA) A single-page application (SPA), is a web application or web site that fits on a single web page with the goal of providing a more fluid user experience akin to a desktop application. AngularJS Basics 9 AngularJS : 2-way binding AngularJS deals with the problem by continuously updating model and view on its own. This is two-way data binding AngularJS Basics 10 AngularJS : Declarative DOM manipulation in AngularJS is controlled by directives which are identical to HTML tags and attributes in declaration. This Declarative Approach helps developer to understand the behavior of app easily. AngularJS Basics 11 AngularJS : Structure AngularJS Basics 12 AngularJS App App Initialization App Ini'alizaon can we broken in mul'ple steps 1. Embedding AngularJS library 2. Seng up ng-app 3. Binding ng-app with Angular Module Angular Core Library : angular.js Angular Route Library : angular-route.js Angular Cookies Library : angular-cookies.js Full list: https://docs.angularjs.org/misc/downloading AngularJS Basics 14 Angular Module : ng-app ng-app is an in-built direc've which is used to - Ini@alizing Angular code in HTML sec@on - Aaching a par@cular angular module <body ng-app = “MyApp”> - HTML var app = angular.module ( “MyApp” , [] ) - JS AngularJS Basics 15 Data Model : ng-model ng-model is an in-built direc've which is used to - bind input data to scope of controller <input ng-model = “data”> - HTML $scope.data - JS AngularJS Basics 16 Angular Expressions Angular Expression have different forms - When used in in-built direcve - When used anywhere in HTML <input ng-model = “data”> <p>{{data}}</p> <img src={{data}} > AngularJS Basics 17 Controllers & Scope Controllers : ng-controller Angular Controller is container for logic in certain section - Multiple Controllers can be used - App with no controllers also works - Scope is bound to a particular controller <div ng-controller = “homeCtrl”> </div> <div ng-controller = “menuCtrl”> </div> AngularJS Basics 19 Define Controllers - Controllers are aached to angular module. - Mul@ple controllers can be aGached using chaining - Controllers also maintain list of dependencies .controller ( “homeCtrl” , function ($scope) { $scope.data ; }) .controller ( “menuCtrl” , function ($scope) { $scope.data ; }) AngularJS Basics 20 $scope $scope contains all properties and methods of a controller scope .controller ( “homeCtrl” , function ($scope) { $scope.data ; }) .controller ( “menuCtrl” , function ($scope) { $scope.data ; }) AngularJS Basics 21 Thank You AngularJS Basics 22 .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    22 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us