https://www.npmjs.com/package/typescript
search for typescript in find packages and install using 'npm install -g typescript'
create two directories src and dist in same directory
npm run compile
go to es6-features.org website
www.typescriptlang.org
Java script features:
default parameters
http://bit.ly/javascript-training-videos
Rest operator
Spread operator
typescript-lang.org
An Angular properties are:
module
component
directive
pipe
service
in angular 1.x everything is function and in angular 2.x everything is class.
A module is a collection of services, directives, controllers, filters, and configuration information.
Component is template.
Directive is dom manipulation.
pipe is used for transforming data for presentation.
service is non UI logic.
command to install a tool to help us create angular application.
npm install -g @angular/cli
run command to list all the commands
ng --help
search for typescript in find packages and install using 'npm install -g typescript'
create two directories src and dist in same directory
npm run compile
go to es6-features.org website
www.typescriptlang.org
Java script features:
default parameters
http://bit.ly/javascript-training-videos
Rest operator
Spread operator
typescript-lang.org
An Angular properties are:
module
component
directive
pipe
service
in angular 1.x everything is function and in angular 2.x everything is class.
A module is a collection of services, directives, controllers, filters, and configuration information.
Component is template.
Directive is dom manipulation.
pipe is used for transforming data for presentation.
service is non UI logic.
command to install a tool to help us create angular application.
npm install -g @angular/cli
run command to list all the commands
ng --help
How to create new project
ng new first-app
this will take more time, so exit using ctrl+c and go to directory
cd first-app
now run below command to install
npm install
now run below command to create application
npm run start
now you can view your application :
http://localhost:4200/
ng new first-app
this will take more time, so exit using ctrl+c and go to directory
cd first-app
now run below command to install
npm install
now run below command to create application
npm run start
now you can view your application :
http://localhost:4200/
command to generate component directory and respective files using angular cli:
ng generate component [name] generates a component folder in the directory where it had run and creates html .ts and .spec.ts files.
example: ng generate component accountlist
it creates several direectory.
package.json is configuration file.
tslint.json check whether coding standards are followed by you in the project or not it is configuration file.
karma.conf.js is a tool to execute your tests in different browsers.
protractor.conf.js end user testing. useful to write end to end testing. this is configuration file.
@NgModule is annotatioin to specify a class as module.
app.component.js is a class and exporting the class which is coming from angular/core.
main.ts
by default anything defined in ts will not be shown to user unless you export it.
Day 5:
==========================
pure function:
method defined in component will gets triggered twice for every state change.
Redux is used to maintain data/store. Redux is available as ngRx for angular. so explore it in free time. It is state manager for angular.
underscore in java is alternate to for loop in java.
filter/maps also.
example in javascript for not using for loop:
numbers[] = {1,2,3,4,5,6};
numbers.filter(function(number){return number%2===0;})
using map
numbers.map() copy one list to another.
numbers.reduce is used to reduce the list or peforming aggregate functions.
window.localStorage for local storage.
======================
* key/value store
* key & value must be strings
* key can be incremental value starting 1
* use JSON.stringify /JSON.parse for serialization or deserialization
*local storage uses Same origin policy meaning only one domain like a.com:444 can access it
* API's
=====
- setItem(key,value)
- getItem(key) returns value
- removeItem(key)
- key(index) return key of index
- clear()
- length
Type Script playground link:
from command prompt we can run "tsc app.ts" to generate app.js file.
References:
No comments:
Post a Comment