在新的Angular2框架中,有没有人知道像事件一样悬停的正确方法?
在Angular1中有ng-Mouseover
,但似乎没有结转.
我查看了文档但没有找到任何内容.
我创建了一个新的存储库,能够使用 SSH 进行克隆并提交以及所有内容。但是当我尝试推送时,出现以下错误:
ERROR: Permission to Ronin11/MealPlanr.git denied to deploy key
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
Run Code Online (Sandbox Code Playgroud)
使用:
ssh -T git@github.com
Run Code Online (Sandbox Code Playgroud)
我能够验证我的 ssh 密钥是否有效。我不知道发生了什么。这只是前几天工作。我已经几个月没有碰过这些设置了。所有这些都是在 Mac 上使用终端。
帮助!
因此,我使用如下基本拦截器创建了一个angular2模块来处理HTTP拦截:
@Injectable()
export class RequestInterceptor implements HttpInterceptor {
constructor(private injector: Injector) {}
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
const authService = this.injector.get(AuthService);
if(authService.isAuthenticated()){
const authReq = request.clone({
setHeaders: {
Authorization: `Bearer ${authService.getAccessToken()}`
}
});
let handle = next.handle(authReq).do(event => {
if(event instanceof HttpResponse){
if(event.headers.has('Authorization')){
authService.updateToken(event.headers.get('Authorization').split(' ')[1]);
}
}
});
return handle;
}else{
return next.handle(request);
}
}
}
Run Code Online (Sandbox Code Playgroud)
当从服务器发送一个新的授权标头时,它将为http请求添加一个授权标头,并更新其自己的标头。它的导入和正常提供如下:
{
provide: HTTP_INTERCEPTORS,
useClass: RequestInterceptor,
multi: true
},
Run Code Online (Sandbox Code Playgroud)
因此,将auth angular2模块编译并导入到我的app.module.t中,效果很好。直到我尝试从子模块中使用它。此处的最高答案:Angular2中从父模块到子模块的继承导入声称angular2不会让您全局使用整个应用程序。它是否正确?
通过导入RequestInterceptor并在模块的提供程序中对其进行设置,我可以从子模块中获得该功能,但是我不想这样做,以使其使用起来不那么麻烦。