Of course, to see the issue, click on 'Entity'. thanks! On Sun, Sep 6, 2015 at 2:01 PM, Lior M <[email protected]> wrote:
> Hi Eric/Everyone > > I tried to use this simple approach on an application with a router, and > it turned out not so simple. > > The plunker is here <http://plnkr.co/edit/gGZJZE?p=preview> > > so one issue, is that with a router, the transcluded ng-content is not > bound at first. Why is that? > > But the really interesting issue, is that after setTimeout, the items are > bound again. Any ideas?? All we do is console.log it... > > thanks so much for any idea > Lior > > > On Tuesday, September 1, 2015 at 4:43:55 AM UTC+3, Eric Martinez wrote: >> >> Hey Lior, >> >> first of all, I'm going to solve this using alpha36 which was released >> today >> >> Your first issue is that you are using "content" which was replaced with >> "ng-content" a few alphas ago (don't remember how many). >> Second, I'm assuming that you are injecting "C2Dropdown" into another >> Component (I'll call it MainCmp), so your code would look like this >> >> @Component({ >> selector: 'c2-dropdown', >> properties:['items'] >> }) >> @View({ >> template: ` >> <div> >> <ng-content></ng-content> >> </div>` >> }) >> export class C2Dropdown { >> constructor() { >> } >> >> } >> >> >> @Component({ >> selector : 'app' >> }) >> @View({ >> template: ` >> <c2-dropdown items="['11','12']"> >> ++{{items}}++ >> </c2-dropdown>`, >> directives : [C2Dropdown] >> }) >> class MainCmp { >> constructor() { >> } >> >> >> onInit() { >> } >> } >> bootstrap(MainCmp); >> >> If you want to set a attach a property to a component, you must enclose >> it within "[]". Another issue, since you are calling "{{items}}" from a >> MainCmp, the compiler is looking for "items" in MainCmp. >> >> The easiest way to do what you want is like this >> >> @View({ >> template: ` >> <c2-dropdown #dropdown items="['11','12']"> >> ++{{dropdown.items}}++ >> </c2-dropdown>`, >> >> Like this you are binding the component to "#dropdown" and then you are >> printing "dropdown"'s items. >> >> For you can look it better I've set up this plnkr: >> http://plnkr.co/edit/87uJVSfojFgcCVNfC3XP?p=preview >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "AngularJS" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/angular/8yoAgJOdwNU/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/angular. > For more options, visit https://groups.google.com/d/optout. > -- Lior Messinger +1-646-3730044 +972-546-888401 -- 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 http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
