Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Kendo directives without transclusions in 1.0.0 #285

Closed
olexme opened this issue Apr 15, 2014 · 6 comments
Closed

Kendo directives without transclusions in 1.0.0 #285

olexme opened this issue Apr 15, 2014 · 6 comments

Comments

@olexme
Copy link

olexme commented Apr 15, 2014

Transclusion in kendo is required and was widely used in custom directives with angular-kendo v0.6. In v1.0.0 transclusion part is commented.

Consider this directive template example, it's not working any more without kendo transclusions :

This is breaking change - please restore it.

@mishoo
Copy link
Contributor

mishoo commented Apr 15, 2014

Your example got lost for some reason, can you re-post it?

I commented out the transclusion because it was generating the other bug (#90). I never understood why was it important, if you can explain I'll reconsider.

@olexme
Copy link
Author

olexme commented Apr 15, 2014

Sorry my example was removed, now you should see it.
This is simplified template of directive which transcludes custom content into ng-transclude.

    <div id="collectionEditor">
        <ul class="list-group ra-list-group" kendo-sortable k-options="options">
            <div ng-transclude></div>
        </ul>
    </div>

Transclusion will work if all previous directives enable transclusion.
My example is working when I uncomment in angular-kendo v.1.0.0 transculsion part; I'm using AngularJS v1.2.14.

@mohlsen
Copy link

mohlsen commented Apr 15, 2014

Transclusion is very important when you have content that needs to be wrapped by a directive. This is almost required for some of the Kendo directives, like the sortable one @olexme mentioned. Here is a plunker that we worked on a few weeks ago, that uses transclusion (using angular-kendo .6):

http://plnkr.co/edit/g0UQWP?p=preview

In the example, in order for the content within the <ul> to work with kendo-sortable, transclusion needs to be used:

    <ul id="sortable" kendo-sortable k-options="sortableOptions">
        <li class="sortable" ng-repeat="item in sortableValue.data">
            {{item.name}}
        </li>
    </ul>

Here is a version of the same plunker but using the latest v1.0.0 of angular-kendo:
http://plnkr.co/edit/DOzjqa?p=preview

There appears to be another JS issue happening in that example, but certainly without transclusion, it will not function correctly.

@olexme
Copy link
Author

olexme commented Apr 15, 2014

Thanks mholsen for example.
I modified that plunker and added two directives with transclusions:

  1. First anyTranscludingDir which do nothing, just transcludes provided content,
  2. Second myKendoSort which besides kendo-sortable uses anyTranscludingDir in its template and also transcludes provided content.

http://plnkr.co/edit/g78bVS9Hq1i2dhWSM4RI?p=preview
Now this example is working but when you comment out lines 139-145 in angular-kendo.js
(like this originally is) you will get following error in console:

Illegal use of ngTransclude directive in the template! No parent directive that requires a transclusion found. 

@mishoo
Copy link
Contributor

mishoo commented Apr 15, 2014

Thanks both for the explanations. I'll uncomment those lines, after I figure out how to mitigate issues like #90.

@mohlsen
Copy link

mohlsen commented Apr 15, 2014

I am not sure the problem that was being solved in #90 exists anymore. I forked the plunk that was created by @passelin in that issue (http://plnkr.co/edit/WP7SJA66Aqg9e8aNYteG?p=preview), and made the following updates:

  • Changed KendoUI references to v2014.1.318 (js and CSS)
  • Changed jQuery to v2.0.3
  • Changed Angular to v1.2.14

I left angular-kendo alone (old version with transclude happening), and it does not appear to be destroying scope and the child dropdown works after the first panel is removed.

http://plnkr.co/edit/iskQGD?p=preview

Perhaps the "fix" by removing transclusion was not really needed, and the underlying issue was fixed in newer versions of angular (or Kendo).

@mishoo mishoo closed this as completed in 3f6ab44 Apr 16, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants