我已經開始使用此處找到的開發工具包的項目:https://github.com/datatypevoid/ng2-mean-webpack。一切似乎都完全正常工作,當我創建的參數屬性的新類(正式打字文件在這裏所看到:https://www.typescriptlang.org/docs/handbook/classes.html)除外,我在控制檯中的錯誤消息說:Angular2類的構造函數錯誤:沒有數字提供商
ORIGINAL EXCEPTION: No provider for Number!
這裏是我的類:
@Component({
selector: 'grid-tile',
template: require('./grid-tile.component.html'),
styleUrls: [require('!style!css!sass!./grid-tile.component.scss')],
providers: [],
directives: [],
pipes: []
})
export class GridTile extends Tile {
constructor(private x:number, private y: number) {
super();
}
}
而一個在這裏是我如何創建實例:
var tile = new GridTile(3,4);
tiles.push(tile);
我真的很感激,發現此proble的解決方案隨着我進一步發展。我遵循Angular2 Tour of Heroes教程和參數屬性似乎工作正常,所以我想知道它是否與開發工具包有關或者只是我傳遞的東西..我完全是新的Angular2 ,所以這可能是我的錯。謝謝您的幫助。
爲了記錄在案,包筆者上市已被棄用,搬到這裏:https://github.com/datatypevoid/vulgar –