Reputation: 133
How can I use a variable defined in a typescript file of a component, in my index.html file in angular 4?
Upvotes: 0
Views: 10418
Reputation: 6548
you cannot use this in index.html directly but you can use this by assigning the value in a component.ts file like
yourvariable : string;
and use this variable only in a component.html file which is been of the same type.
like {{yourvariable}}
you can also access this variable to any component.
in angular index.html is the starting point of view in which there is component based div structure. you can add variable there using above procedure.
Upvotes: 3