Ionic code inside the HTML page


I want to add some ionic code inside my HTML page
How can i achieve it.
For ex.
I want below code should come in my HTML page
import Component } from ‘@angular/core’;

  selector: 'rio-hello',
  template: '<p>Hello, {{name}}!</p>',
export class HelloComponent {
  name: string;

  constructor() { = 'World';

So i can get something like thissnippet


I don’t know where is your problem , it seems like you know how to use it !
if you have a variable and you want to use it in your view file (html file) all you need to do is putting the variable’s name between two brackets like this :
or in your case :


No @keloa… i am not asking about this.
I just want to add some code in HTML page…
so that i can show the code direct…like we can do with the code tag

u can see this…for reference


I think this is a very bad idea and you should try to think of another way to achieve your ultimate goal. ngc really wants static templates in order to build properly, and any attempt to subvert that is going to cause you more trouble than it’s worth, IMHO.


Can you please suggest me how can i achieve this…or how can i place the code something like this.


Difficult to say more without knowing what you’re trying to do, but here’s what I do with Markdown.


i didn’t understand this…that how can i achieve
Can you please provide me any demo of it.


I gave you what I use. If you can’t adapt it, you have to describe what you are really trying to achieve, at as high a level as possible, because if you keep saying “I want to embed Ionic directives in HTML injected from the controller”, my answer is going to keep being “no, you don’t”.