I'm doing a angularjs blog tutorial, in the code example I see this new file type "tpl.html":
$routeProvider
.when('/', {
templateUrl: 'views/post-list.tpl.html',
controller: 'PostListController',
controllerAs: 'postlist'
})
.when('/post/:postId', {
templateUrl: 'views/post-detail.tpl.html',
controller: 'PostDetailController',
controllerAs: 'postdetail'
})
.when('/new', {
templateUrl: 'views/post-create.tpl.html',
controller: 'PostCreateController',
controllerAs: 'postcreate'
});
What is this file type? Is different to html files?
The .tpl file extension is used by a template parser called Smarty. This is an HTML template parser. Developers append .html to the end of the file so they can be recognized by text editors as HTML file and provide syntax checking, intellisense, and stuff.
It is just a little helper added by the author to mark these files as templates. This could be helpful when you see these files not in context - e.g. in the file system. You can name these html files how you like it! :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With