How to use(inject) html/page in other pages?


#1

how to use(inject) html/page in other pages?
i know how to use providers and directives, bu cant manage to inject page html in other page html:
(i put # in code otherwise it doesn’t show)
example:
selector: p-1
export…p1
page1.html:

<p>this is page 1</p>

and in page2.html:
<p-1></p-1>

result of page 2:
this is page 1


#2

If that’s the structure of what you want to achieve, use normal components, don’t use pages. They’re not designed to be injected in the template way. They are designed to be pushed on a stack and then they’ll be shown to the user.

If you want to put code on the forum, select your code and format it with the < /> button btw.


#3

thanks for the answer.

can i use angular components in ionic?? same syntex?

and if you can show me the </> thing…didnt understand.

thanks,


#4

Yes you can use normal angular2 components inside an ionic app. A page is actually also a component, but it’s a ‘special’ component.


#5

tnx
and how do i paste code?
<#p>?

didnt understand your answer


#6

Use the button on the text editor:


#7

Please edit your post and use the </> button above the post input field to format your code or error message or wrap it in ``` (“code fences”) manually. This will make sure your text is readable and if it recognizes the programming language it also automatically adds code syntax highlighting. Thanks.