AngularJS Tutorial

  • Cookies help us deliver our services.
  • By using our services, you agree to our use of cookies

Easy guide to AngularJS offline tutorial
Continue reading “AngularJS Tutorial”

Learning AngularJS Basics

Learning AngularJS Basics | Part 3  #javascript

  • ObjectiveIn this lesson, we are intended to learn the following:AngularJS ScopesLet’s begin…AngularJS ScopesWe’ll be discussing two types of scopes:$scope$rootScope $scopeAs we all know after the last lesson, that whenever you write a controller in AngularJS, it looks something like this:script var app = angular.module(“appModule”, []); function( $scope ) { // Code inside the controller };/scriptIf you notice, you’ll see that we passed $scope object as an argument.So in easy words$scope is an object — and if we add any properties to this object, those properties will be accessible in the view (HTML).
  • The job of Model, View and Controller is as follows:Model: All the data available for the current view.View: Everything you see, in our case HTMLController: Javascript functions that make changes to data.Hence according to the previous explanation, $scope refers to Model.Let’s look at some examples.Example | AngularJS ScopesProblem statement: Create a module and controller called appModule and appController respectively.
  • Solution: Please have a look at the following code and try to understand it.scriptvar app = angular.module(“appModule”, function( $scope ) { $scope.name = “Fahad A. Chaudhry”; };/scriptbody ng-app=”appModule” ng-controller=”appController” {{ name }}/bodyExplanation: We begin by passing $scope object as an argument in controller.
  • Then inside the controller, we create a new property associated to $scope called name.To show this name in the view (HTML), we use expression notation and simply write the name of the property inside double-curly-brackets,ie: {{ name }}So we understand that in view we don’t use $scope as a prefix, rather we simply write the property name in double-curly-brackets.
  • Adding properties to $rootScope is same as adding to $scope$rootScope.newProperty = “This is a new property”;And if you want to show the value of your $rootScope in the View then you’ll use exactly same method, ie: just write the property name in between double-curly-brackets{{ newProperty }}$rootScope is a scope that is created on HTML elements that are enclosed by ng-app directive whereas $scope is limited to HTML elements that are enclosed in ng-controller directive.scriptvar app = angular.module(“appModule”, []);app.run(function( $rootScope ) { $rootScope.name = “Name from function( $scope ) { $scope.name = “Name from scope”; };/scriptbody ng-app=”appModule” {{ name }} !

In our previous lesson, we discussed about basic components of an AngularJS application, what is an AngularJS Module and what is an AngularJS Controller. As we all know after the last lesson, that…
Continue reading “Learning AngularJS Basics”

Learn HTML

  • Cookies help us deliver our services.
  • By using our services, you agree to our use of cookies

Learn HTML tag with code syntax.
Continue reading “Learn HTML”

AngularJS Tutorial

  • Cookies help us deliver our services.
  • By using our services, you agree to our use of cookies

Easy guide to AngularJS offline tutorial
Continue reading “AngularJS Tutorial”

Learn HTML

  • Cookies help us deliver our services.
  • By using our services, you agree to our use of cookies

Learn HTML tag with code syntax.
Continue reading “Learn HTML”

Understand Angular 2 Directives in Depth

Understand Angular 2 Directives in Depth course by @johnlindquist #angular2

  • Angular 2 Directives allow you to add custom behavior to elements and components.
  • Rather than creating a hierarchy of components to try to “extend” behavior, Angular 2 Directives enable you to compose behaviors on to your components.
  • This includes adding event listeners that hook into services, manipulating templates, and adding more configuration to basic elements.
  • This course helps you understand the concepts around building our Angular 2 directives and provides examples from basic directives that inspect elements to advanced structural directives that completely re-write templates.
  • If Angular 2 is new and the syntax foreign, you will want to check out Get Started with Angular 2 and Building Angular 2 Components.

Angular 2 Directives allow you to add custom behavior to elements and components. Rather than creating a hierarchy of components to try to “extend” behavior, Angular 2 Directives enable you to compose behaviors on to your components. This includes adding event listeners that hook into services, manipulating templates, and adding more configuration to basic elements. This course helps you understand the concepts around building our Angular 2 directives and provides examples from basic directives that inspect elements to advanced structural directives that completely re-write templates.
If Angular 2 is new and the syntax foreign, you will want to check out [Get Started with Angular 2](https://egghead.io/courses/angular-2-fundamentals) and [Building Angular 2 Components](https://egghead.io/courses/building-angular-2-components).

Continue reading “Understand Angular 2 Directives in Depth”

Learn HTML

  • Cookies help us deliver our services.
  • By using our services, you agree to our use of cookies

Learn HTML tag with code syntax.
Continue reading “Learn HTML”