Aman Gupta
Aman Gupta

Reputation: 8131

Angular create a template on the fly

I've been reading alot about the route provider and how you can load different templates by specifying the url path.

Is there a way where instead of providing a path to template, we could programatically generate a view on the fly and attach it to the controller?

Upvotes: 0

Views: 578

Answers (1)

edamon
edamon

Reputation: 74

you can dynamically create a template in a directive using $compile.

here's another example: http://onehungrymind.com/angularjs-dynamic-templates/.

I'm not sure how you do that using just the router though. I think you need to add more context to you're question.

Upvotes: 1

Related Questions