Sess2 Angular Install Project Setup
Sess2 Angular Install Project Setup
( formerly Angular 4 )
One framework.
Mobile & desktop.
Agenda
Introduction of Angular.
Features of Angular.
Development environment setup.
Project setup
Structure of Angular project.
How to install packages.
What is TypeScript .
How Angular application start.
Components.
How to create component.
Styling component.
Component selector.
Databinding
Angular
• Developed by Google
Development
Productivity
Cross Platform
Build native mobile apps with Ionic Framework, NativeScript, and React Native.
Angular turns our templates into code that's highly optimized for today's JavaScript
machines.
Serve the first view of your application on node.js, .NET, PHP, and other servers for
Get intelligent code completion, instant errors in popular editors and IDEs.
Full Development Story
Karma for unit tests.
Protractor makes our scenario tests run faster and in a stable manner.
Text Editor
F:/Angular4/MyFirstDemoApp> ng serve
Open web browser -
localhost:4200
Structure of project
NPM is the node package manager, which installs packages
locally into a project, specifically, into the node_modules
folder.
Configuration Files
Installing Packages
npm install command is used for installing packages.
Syntax Example
npm install <package_name> F:/Angular4/MyFirstDemoApp> npm install bootsrap
How App Start
• Main.ts file is entry point of our application.
main.ts • Main.ts file bootstrap app.module.ts file
It is syntactical superset of JavaScript and adds optional static typings and class
Template is used to render This is like a class defined in any This has the styles defined
the view for the application. language such as C#. for the Angular html file.
This contains the HTML This has the code which is used
that
to support the view.
needs to be rendered in the
It is defined in TypeScript.
application.
We are using the import keyword to
import the ‘Component’ decorator
from the angular/core module.
Decorator
Syntax Example
Example
Syntax
@Component({ sele
@Component({
ctor: ‘.app-root',
selector: ‘.selector-name',
templateUrl: './app.component.html',
templateUrl: ‘html - template',
styleUrls: ['./app.component.css']
styleUrls: [‘stylesheet']
})
})
Example
Syntax
export class AppComponent
export class <class_name>
{
{
title = ‘This is my demo app';
variableName = ‘any string';
}
}
HTML Typescript
export class ClientComponent {
<button [disabled]="!isActive" isActive = false;
class="btn">ADD</button> constructor() {
setTimeout(()
=>
{ this.isActive =
true; }, 2000); } ngOnInit() { }