URL vs ComponentURL vs TemplateURL

Hello everyone,

I just wanted to ask what’s the difference between url, componenturl, and templateurl in route properties.

From what I know, the difference that I can see clearly is the View that you’re trying to load with that route
url : Basically you just load a Normal View, which contain only HTML and nothing else
componentURL : This is so powerfull, it can contains HTML , css, and even some javascript code. It also can have parameter in the ‘path’ route property
templateURL : I dont have any idea with this route properties. From the ‘ready to use’ template, I see that the view kinda same like the one that componentUrl have, but I’m not sure if it can have css and javascript. This one also can have parameter in the ‘path’ route property

With this information, I’ll be using componentUrl and there’s no reason to use the other two properties. Except If i want to make a static Page, I think it would be okay with url
But I’m sure that I must be wrong with this thought. Maybe there’s a something about the security or anything.

I already see this question When should I use componentUrl and when should I use just url? But it doesn’t have much information

It’ll be great if you can explain it deeply to me and maybe there’s another people out there that have question like me.

Thank you.

PS : I’m new to framework7 espescially since v2. I worked a college project using v1 and then there’s pretty big overhaull since v2. Now I’m using v4 and tryng to understand about it.

1 Like

If you don’t need any specific logic, just load plain HTML as page content, then go with url.
If you need any additional page-specific logic, like scripts, styles then go with componentUrl.
templateUrl is in between url and componentUrl. It gets file content and parses it as Template7 string -> means you may have pretty limited basic logic (like if, else) in template.

4 Likes

Thank you SO MUCH for asking this! I thinkt that the docs could explain this a bit better so thanks to @nolimits4web with his reply as his short answer explains everything absolutely perfect.

So, thank you both for this thread :smiley: