I want to render html template by giving url in Angular2, But template is not loading. I am using visual studio code editor, Below is my code and structure.
import {Component} from 'angular2/core';
import {LoginComponent} from '../Login/login.component'
@Component({
selector: 'my-app',
// template: '<h1>Yash Employees</h1><login></login>',
templateUrl: './app.html',
directives: [LoginComponent]
})
export class AppComponent { }
template attribute is working, But templateUrl is not.
app.html contains only single line,
<h1>hi</h1>
What I need to change to resolve this?
Use Urls for your templateUrl properties as below,
@Component({
selector: 'my-app',
templateUrl: './app/component/app/app.html',
directives: [LoginComponent]
})
Update : As per the documentation ./filename
should work but in your case you say that it is not working I wounder.