This is a migrated thread and some comments may be shown as answers.

Angular template inside kendo directive markup

1 Answer 467 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 19 Sep 2014, 01:47 PM
Hi,

I'd like to use the Kendo drop down with an Angular template inside the markup or some referenced file.
In my case it is used like this at the moment:

<select ...
k-template="'<b>#: displayName #</b><br/>#: name #'"
k-value-template="'#: displayName #'">
</select>

But I would like to use it the "angular way", like:

<select ...
k-template="'<b>{{dataItem.displayName}}</b><br/>{{dataItem.name}}'"
k-value-template="'{{dataItem.displayName}}'">
</select>


That way, the drop down items, defined in the template, only appear, if I declare the template manually inside some "k-options". I've already experimented with the "ng-non-bindable" attribute, so that the angular expression can be interpreted later, but without success.
Some advice would be helpful.

I'm also looking for a solution to reference some template url. Can this be done natively with Angular or Kendo?

Kind Regards
Thomas

1 Answer, 1 is accepted

Sort by
0
Mihai
Telerik team
answered on 23 Sep 2014, 07:44 AM
Hi Thomas,

You can't include the template inline in the k-template attribute, because it will be converted by Angular before our directive even runs.  And ng-non-bindable wouldn't work because it applies to the whole element, so the select will not be converted to a Kendo DropDown anymore.

So that indeed leaves the only option of declaring it in a scope variable.  Here is a sample: http://dojo.telerik.com/@mishoo/EGiD

You can easily reference an external template using Angular's own ngInclude directive (commented out in my sample, but I've checked locally and that works).

Regards,
Mihai
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
DropDownList
Asked by
Tom
Top achievements
Rank 1
Answers by
Mihai
Telerik team
Share this question
or