Ionic code inside the HTML page


#1

Hi
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
//code
import Component } from ‘@angular/core’;

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

  constructor() {
    this.name = 'World';
  }
}

So i can get something like thissnippet


#2

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 :
{{variable}}
or in your case :
{{name}}


#3

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


#4

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.


#5

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


#6

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


#7

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


#8

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”.