C
C
Coder3212016-11-10 20:12:44
Angular
Coder321, 2016-11-10 20:12:44

Passing data to an Angular 2 component?

How to pass a two-way variable to a component in Angular 2, like what was done in the first Angular using

scope:{ 
data: '=',
callback:'&'
}

Tried it like this
<my-component [(test)]="test" [(callback)]="callback"></my-comonent>

callback(){
console.log(this)
}

When the callback is run, my-component prints this of the parent component, not my-component.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeniy Samoilenko, 2016-11-10
@samoilenkoevgeniy

banana in box:
[(name)]='variable'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question