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 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.