Load from html

22 views
Skip to first unread message

Jonathan Van Belle

unread,
Oct 9, 2014, 4:04:42 AM10/9/14
to ang...@googlegroups.com
Hi,
I'm wondering if it's possible to load pure html web page, and after it, use angular on it to make some greate stuff.

Here is an example : http://jsfiddle.net/aewfwrLj/
What i would like is something like this http://jsfiddle.net/5mpwj7Lu/1/ . It's the same as preview but with plain old pure html. And on this html, I would like to do something to say, hey, now use angular fun to do stuff.


Is it possible or is it plain to do it?

thanks

Bernard Poulin

unread,
Oct 9, 2014, 3:23:06 PM10/9/14
to ang...@googlegroups.com
Not sure I follow you. 

You can always find the <li> and add the  property ng-repeat="data in datas | orderBy:sort " and those "ng-model" and then 

You can always "$compile" a piece of the DOM to "activate" the angular magic "after". https://docs.angularjs.org/api/ng/service/$compile

But I believe you will need to "bootstrap" angular on the page before attempting anything magic. https://docs.angularjs.org/guide/bootstrap 

Hope that helps.
B.

Grummfy

unread,
Oct 9, 2014, 4:32:44 PM10/9/14
to ang...@googlegroups.com
But not so sure this is really very optimized. But the idea is over there. If you ahve suggestion to improve it.

--
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/IauRIGu0qZA/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/d/optout.

--
Van Belle Jonathan

Bernard Poulin

unread,
Oct 9, 2014, 7:33:18 PM10/9/14
to ang...@googlegroups.com
Yup exactly!

Again it depends what you mean by "pure HTML". Does including the angular script still makes it "pure" in your definition?

Small note: running something that acts on the DOM within a controller on startup might not work if the DOM is not loaded yet. But it will work in about any other case where you know your HTML is present.

Grummfy

unread,
Oct 10, 2014, 3:24:30 AM10/10/14
to ang...@googlegroups.com
Well by pure html, I would like to say with or without angular stuff.

But seems a bit inneficient because we create html and efter delete some part to regenerate new one. The best should be to link each block to some value and say, this is the template to generate it. Now deel with it.


But thanks for the help

Reply all
Reply to author
Forward
0 new messages