Thursday, 15 March 2012

javascript - Passing data between service and directive -


The use case is simple, movie objects have a movie. Jason After this I want to display these objects through nested movies - & gt; Movies. Mediator and data exchange I think is to make the best of service.

The problem is that the data assync loads but instructions do not receive the data model.

The code can be found here

Use = < / Code> binding

  scope: {Data: "= myMovies"},   

instead of @ , because @ string To evaluate my movie attribute values, Ie,

  scope: {Data: "@mimoviz"},   

property data < / Code> will get the value movies . This object is formed with = .

Parent Directive is not required:

  // Required: '^' movie,   

In the director, the instructions are that The property has the property defined by motion picture , so you have to use it in your template:

  Template: '& lt; Div & gt; + '& Lt; H3 & gt; {{Movie.name}} & lt; / H3 & gt; ' + '& Lt; Span & gt; {{Movie.published}} & lt; / Span & gt; ' + '& Lt; / Div>   



No comments:

Post a Comment