Angular 4
Angular 4
ANGULAR
ECMAScript : https://en.wikipedia.org/wiki/ECMAScript
INTRODUCTION TO ANGULAR CONTD..
What is Type Script ?
Free and open-source programming language developed by Microsoft.
Superset of JavaScript.
Transpilation compiles typescript to JavaScript.
TypeScript Benefits
1. Intellisense
2. Autocompletion
3. Code navigation
4. Strong Typing
5. Supports ES 2015 (also called ES 6) features like classes, interfaces and inheritance.
SETTING UP ANGULAR IN VS
How to set up Angular in Visual Studio?
Step 1 : Install Node.js and npm.
Node version 4.6.x or greater
npm 3.x.x or greater.
To check the use commands in a command window.
node -v
npm -v
You can get the latest version of Node.js from the following website.
https://nodejs.org/en/download
Step 2 : Make sure you have Visual Studio 2015 Update 3 installed. To check the version of Visual Studio you have click on
the "Help" menu and then select "About Microsoft Visual Studio"
SETTING UP ANGULAR IN VS
Step 3 : Configure environment settings for node and npm in Visual Studio.
Step 6 : Download the "Quick Start Files" from the Angular web site.
https://github.com/angular/quickstart
Step 7 : Copy the required "Starter files" to the web application project.
SETTING UP ANGULAR IN VS
1. Template - Defines the user interface. Contains the HTML, directives and bindings.
3. Decorator - Decorators add metadata to the class. A class becomes an Angular component, when it is
decorated with the Component decorator.
BINDINGS IN ANGULAR
1. One way binding: Data flow in one direction only. Achieved using property or event binding.
2. Two way binding: Data flows two directions. Achieved using property and event binding together.
ANGULAR SERVICES (DI)
A service is used when common functionality is required.
Single reusable service injected via dependency injection.
Singleton instance is created.
Why dependency injection?
ANGULAR ROUTING
Step 1 : Set <base href=“/src/”> in index.html
Step 2 : Import router module and define routes