我刚刚开始使用 angular 2 和打字稿。当我从 .ts 文件导入类时,编译成功但抛出错误
不是函数 _co.upchange
使用时(click)。
更新.ts
export class Update {
name:string;
}
export class Changeable {
upchange (value) {
console.log(value);
}
}
更新组件.ts
import { Component, OnInit } from '@angular/core';
import { Update } from './Update';
import { Changeable } from './Update';
@Component({
selector: 'app-update',
templateUrl: './update.component.html',
styleUrls: ['./update.component.css']
})
export class UpdateComponent implements OnInit {
update:Update = {
name:'Bhavya',
}
constructor() { }
ngOnInit() {
}
}