Angular 2 is the latest framework for building web applications using typescript. Recently, angular team is skipped the version 3.x because, router package is shipped with 3.x previously, so instead of putting into 3.x, choose to move to 4.x.

Thursday, 8 December 2016

User Input in angular2

So far we discussed about data binding. Now will learn, how to pass data into the components.

@Input
We have to use @input decorator to define an input.
 
<my-name [name]=""username"></my-name>

import { Component, Input } from '@angular/core'
@Component({
selector: 'my-name' ,
template: '<p>{{name.fullname}}'
})
export class UserDetails {
 @Input() name;
  constructor() {}
}

0 coment�rios:

Post a Comment

Labels

Online Training

Your Name :
Your Email: (required)
Your Message: (required)

Powered by Blogger.

Recent Posts

Find Us On Facebook

Popular Posts