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

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)
selector: p-1

<p>this is page 1</p>

and in page2.html:

result of page 2:
this is page 1

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.

1 Like

thanks for the answer.

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

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


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

and how do i paste code?

didnt understand your answer

Use the button on the text editor:


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.

1 Like