我正在尝试在Angular2 rc1 TypeScript项目中使用auth0.js库来进行自定义注册。我需要将auth0 lib注入我的组件并从TypeScript获取“找不到模块'auth0'”。
配置
npm install auth0-js --save
typings install dt~auth0 --save --global
signupForm.component.ts:
import * as auth0 from "auth0-js"; //TypeScript: TS2307: Cannot find module 'auth0-js'
@Component({...})
export class SignupForm {
constructor(private auth:auth0){}
...
}
main.ts
...
import * as auth0 from "auth0-js"; //TypeScript: TS2307: Cannot find module 'auth0-js'
bootstrap(..., [provide(auth0, { useFactory: () => {
return new auth0({...});
}})
]);