[[object HTMLUlistElement]] after compile is outputed

239 views
Skip to first unread message

Yonatan Kra

unread,
Jan 29, 2014, 2:44:03 PM1/29/14
to ang...@googlegroups.com
Hi,
I have this code inside my directive "list-directive":
return function(scope){
var html_markup = '<ul><li ng-repeat="item in items"><ng-include src="item.contentUrl"></ng-include></li></ul>';
elm.html($compile(html_markup)(scope);
}

in my controller I have:
$scope.items = [
{contentUrl: "myDomain.com"},
{contentUrl: "myDomain.co"},
{contentUrl: "myDomain.com.be"}
];

in my partial I have:
<ul list-directive>

Sometimes I see my list after the page loads.
Sometimes when the page loads, I get:[[object HTMLUlistElement]] and in my console, $compile(html_markup)(scope) returns an empty jquery object when this happens.
Any idea why this happens and how to solve it?

Sander Elias

unread,
Jan 29, 2014, 9:52:43 PM1/29/14
to ang...@googlegroups.com
Hi Yonatan,

No, I have no idea. Why the complexity in your directive? Couldn't you use a normal template directive?
If you put up a plunk or fiddle illustrating your problem, sure one of us is willing to take a look.

Regards,
Sander Elias

Yonatan Kra

unread,
Jan 30, 2014, 2:07:21 AM1/30/14
to ang...@googlegroups.com
Hi Sander,
My code is based on the angularjs-requirejs example (https://github.com/StarterSquad/startersquad.github.com/tree/master/examples/angularjs-requirejs-2), so it's a bit hard to put it on plunk/fiddle in whole. I'll try to simplify it for this.
My code complexity arised from kendoui not being compiled normally in my partial, so I had to compile it explicitely before showing the content.
I'm very new to angular (I'm learning it for about a week now).  What do you mean by a "normal template directive"?



--
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/ZPiUsxqZzE0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Yonatan Kra

unread,
Jan 31, 2014, 6:15:04 AM1/31/14
to ang...@googlegroups.com
Ok,
This issue is redundent. Kendoui just updated their plugin to compile external pages within the widget.
Thanks :)
Reply all
Reply to author
Forward
0 new messages