我是新來的,我正在學習一個教程。我的代碼是從正在工作的教程視頻逐字記錄的,但我的代碼不是。我得到錯誤「無法找到名爲‘無極’,我想不通爲什麼。有沒有人有,爲什麼我得到這個錯誤的想法?找不到名字Promise Angular2
import {Control} from 'angular2/common'
export class UsernameValidators{
static shouldBeUnique(control: Control){
return new Promise ((resolve) => {
setTimeout(function(){
if(control.value == "andy")
resolve({shouldBeUnique: true})
else
resolve(null);
}, 1000);
});
}
static cannotContainSpace(control: Control){
if (control.value.indexOf(' ') >=0)
return {cannotContainSpace: true};
return null;
}
}
你是在你的tsconfig中定位ES6嗎? – NPhillips