templateUrl

hi there

i have a folder that contains some html pages:
class-1.html
class-2.html
class-3.html

Im trying to to show a html page in Related which param the page before sent me as NavParam.
Im trying something like this:
@Component({
templateUrl: ‘…/…/assets/classes/class-’ + this.navParams.get(‘classNum’) + ‘.html’
})
and the browser crash.

I’m almost sure it because this.navParams Unknown because i didnt call him in the class.
how can i resolve that?

Thanks

You can’t.

What exactly are you trying to do? I’m sure there’s a way that will work idiomatically in Angular, and not require dirty hacks.

2 Likes

to set my template url with some variable that i keep in my navparams.
i keep the name of the page that i want to show in my nav params befor i push the new page and in this new page i try to set the temlplate url with this variable that contain the name of the page.

thank

Please redesign your app so that it has predictable, consistent, testable, and maintainable behavior. As I understand it, what you are trying to do is madness. Each page needs a consistently-defined template.

1 Like

so how can i keep all my html files into a folder and to choose someone of them to be the template of the page?
i need it because every time i need to show another template.