Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why templateUrl not working?

why templateUrl not working in angular 2.when I used template it works .It not work ..here is my code

http://plnkr.co/edit/WI4gK2vbaj4OUX5ImJor?p=preview

import {Component,View} from 'angular2/core';

@Component({
    selector: 'my-app',
//  template: '<div (click)="onclck()">hello</div>'
})

@View({
  templateUrl: 'home/home.html'
});
export class AppComponent {

  onclck(){
    alert('--')
  }

}
like image 784
user5711656 Avatar asked Feb 08 '23 01:02

user5711656


1 Answers

You have a semi-colon between @View decorator and your export class AppComponent in app/script.ts. Just remove it and it works.

like image 153
Ionut Costica Avatar answered Feb 11 '23 16:02

Ionut Costica