Hello everybody,
Looking for clarification on web based angular 2 tutorial. According to the
tutorial if the value in app.component value(myValue = 0) or empty the
default value from the child component should be the default value. I tried
experimenting with the code it only works if value in App.component is set
to some value. not the otherway round.
.
if myValue:number = 0 or empty from what i can understand from the post,
<counter
[counterValue]="myValue"></counter> this line should display the value
found in contercomponent * counterValue = 5; as a default valule.. is this *
*correct*
Child component
export class CounterComponent {
* @Input() counterValue = 0;*
increment() {
this.counterValue++;
}
decrement() {
this.counterValue--;
}
*}*
app.component
template: `
<div class="app">
<counter [counterValue]="myValue"></counter>
</div>
`,
directives: [CounterComponent]
})
export class AppComponent {
public myValue:number = 0;
}
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.