Re: [angular.js] How to reuse some html blocks in angularjs?

2,542 views
Skip to first unread message

Dan Doyon

unread,
Jun 4, 2012, 2:10:51 PM6/4/12
to ang...@googlegroups.com
Seems like your use case lends itself to directives. http://docs.angularjs.org/guide/directive

directives give you the ability to use both inline and external templates, so this would be where you'd want to put your <form></form> template. 

One thing that you should be careful about is scope and if you need isolation between the forms. 

If you have not done any custom directives yet, you might want to look around for some of the directive type fiddles https://github.com/angular/angular.js/wiki/JsFiddle-Examples

hope this helps

--dan



From: Freewind <nowi...@gmail.com>
To: ang...@googlegroups.com
Sent: Monday, June 4, 2012 10:13 AM
Subject: [angular.js] How to reuse some html blocks in angularjs?

I want to reuse a block of html code. When I click some buttons, it will clone that html code and insert it to somewhere.

See the demo: http://jsfiddle.net/Freewind/PHhN9/

How to do it? Thanks
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/WP150yN9eGEJ.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.


Reply all
Reply to author
Forward
0 new messages