Include the same Angular HTML in 2 files

30 views
Skip to first unread message

Fabrizio Reale

unread,
Mar 30, 2015, 6:11:13 AM3/30/15
to ang...@googlegroups.com
Hello,
I have a a piece of HTML code with Angular directives and I'd like to reuse it into another HTML template.
Is there any good way to do that?

Thank you,
Fabrizio

Tandon, Rishi

unread,
Mar 30, 2015, 4:08:01 PM3/30/15
to ang...@googlegroups.com
Covert the reusable HTML code from the existing directives into another directive and use elsewhere.

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, 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.



--
Rishi Tandon
Pearson Learning Technology Group

Mobile: (310) 926-9032

Pearson
Always Learning
Learn more at www.pearson.com

Fabrizio Reale

unread,
Mar 31, 2015, 8:29:28 AM3/31/15
to ang...@googlegroups.com
Hello Rishi,
and thank you for your answer.


Il giorno lunedì 30 marzo 2015 22:08:01 UTC+2, Rishi Tandon ha scritto:
Covert the reusable HTML code from the existing directives into another directive and use elsewhere.

I need to use this single piece of HTML with Angular data into 2 other HTML files.
Is there any easier approach than creating a directive?

Thank you,
Fabrizio

 

Sander Elias

unread,
Apr 1, 2015, 12:59:41 AM4/1/15
to ang...@googlegroups.com
Hi Fabrizio,

I suspect you want to look at ngInclude. However, it's a better idea to refactor your component into a directive. It might be way simpler then you expect!

Regards
Sander
Reply all
Reply to author
Forward
0 new messages