Last active
January 5, 2018 09:46
-
-
Save kevinchisholm/b7713c96f056238e47c3fc27f3764c1d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Component, Input } from '@angular/core'; | |
@Component({ | |
selector: 'child1', | |
templateUrl: 'src/child1/child1.html', | |
}) | |
export class Child1Component { | |
@Input() userNameFromParent = ''; | |
@Input() userPhoneFromParent = ''; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<strong>Name: </strong> {{userNameFromParent}} | |
<strong>Phone: </strong> {{userPhoneFromParent}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, Input } from '@angular/core'; | |
@Component({ | |
selector: 'child2', | |
templateUrl: 'src/child2/child2.html' | |
}) | |
export class Child2Component { | |
@Input('theUserName') name = ''; | |
@Input('thePhone') phone = ''; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<strong>Name: </strong> {{name}} | |
<strong>Phone: </strong> {{phone}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from '@angular/core'; | |
@Component({ | |
selector: 'parent', | |
templateUrl: 'src/parent/parent.html' | |
}) | |
export class ParentComponent { | |
public userName = ''; | |
public userPhone = ''; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input | |
type="text" | |
[(ngModel)]="userName" | |
placeholder="Enter user name here"> | |
<input | |
type="text" | |
[(ngModel)]="userPhone" | |
placeholder="Enter user phone number here"> | |
<child1 | |
userNameFromParent="{{userName}}" | |
userPhoneFromParent="{{userPhone}}"></child1> | |
<child2 | |
theUserName="{{userName}}" | |
thePhone="{{userPhone}}"></child2> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment