小编Jos*_*osh的帖子

[at-loader] node_modules\@types\jasmine中的错误

我的webpack构建开始失败,没有更新软件包.我假设一些次要的版本更新导致了这一点,但无法弄清楚如何解决它.有谁知道该怎么办?

ERROR in [at-loader] node_modules\@types\jasmine\index.d.ts:39:52 
    TS1005: '=' expected.
ERROR in [at-loader] node_modules\@types\jasmine\index.d.ts:39:38 
    TS2371: A parameter initializer is only allowed in a function or constructor implementation.
ERROR in [at-loader] node_modules\@types\jasmine\index.d.ts:39:46 
    TS2304: Cannot find name 'keyof'.
Run Code Online (Sandbox Code Playgroud)

的package.json

  "dependencies": {
    "@angular/common": "2.4.7",
    "@angular/compiler": "~2.4.4",
    "@angular/core": "2.4.7",
    "@angular/forms": "2.4.7",
    "@angular/http": "~2.4.4",
    "@angular/material": "^2.0.0-beta.1",
    "@angular/platform-browser": "~2.4.4",
    "@angular/platform-browser-dynamic": "~2.4.4",
    "@angular/platform-server": "~2.4.4",
    "@angular/router": "~3.4.1",
    "@angularclass/conventions-loader": "^1.0.2",
    "@angularclass/hmr": "~1.2.2",
    "@angularclass/hmr-loader": "~3.0.2",
    "@vaadin/angular2-polymer": "^1.0.0",
    "animate.css": "^3.5.2",
    "assets-webpack-plugin": "^3.4.0",
    "bootstrap-sass": "^3.3.7",
    "bootstrap-select": "^1.12.1",
    "bootstrap-tour": "^0.11.0",
    "core-js": "^2.4.1",
    "font-awesome": "^4.7.0",
    "http-server": …
Run Code Online (Sandbox Code Playgroud)

npm jasmine typescript webpack angular

18
推荐指数
2
解决办法
1万
查看次数

Angular2路由保护返回Observable <bool>,如何处理错误

我有一个像下面这样的路线保护

@Injectable()
export class AuthGuard implements CanActivate {

constructor(private router: Router, private authenticationSvc: AuthenticationService) { }

canActivate(): Observable<boolean> {
    return this.authenticationSvc.getAuthenticatedUser().map(
        r => {
            if (this.authenticationSvc.isAuthenticated()) {
                // logged in so return true
                return true;
            }
            this.router.navigateByUrl('/login');
            return false;
        })
}
Run Code Online (Sandbox Code Playgroud)

问题是有时getAuthenticatedUser返回401,我有一个http拦截器来处理401并重定向到登录页面.问题是这个.map永远不会解析,因为http请求会抛出错误,并且角度路由器会卡在第一个路由请求上,无法处理来自拦截器的后续请求.如何处理此错误并将Observable返回的解析为false并保持移动?

  getAuthenticatedUser() {
         let getUserObservable = this.http.get(ApiUrl + 'security/getAuthenticatedUser')
            .map((res: any) => res.json())
            .share()

        //Get the result for the cache
        getUserObservable.subscribe(
            r => {
                if (r.success) {
                    this.authenticatedUser = r.result.user;
                }
            }); 

        //return the observable
        return getUserObservable;
  } 
Run Code Online (Sandbox Code Playgroud)

和http-intercepter下面 …

javascript rxjs typescript angular2-guards angular

8
推荐指数
1
解决办法
1万
查看次数

如何隐藏带有嵌套选项卡组的 mat-tab-header,隐藏外部 mat-tab-group 而不隐藏内部

我本质上有html

<mat-tab-group>
    <mat-tab>
        <mat-tab-group>
            <mat-tab>
            </mat-tab>
        </mat-tab-group>
    </mat-tab>
</mat-tab-group>
Run Code Online (Sandbox Code Playgroud)

如何使用 css (或任何真正的方法)隐藏外部选项卡组 mat-tab-header 元素,但不影响内部选项卡标题?

css sass angular-material angular

7
推荐指数
2
解决办法
1万
查看次数

FontAwesome 5 SVG图标:data-search-pseudo-elements导致渲染速度减慢100倍

当我启用data-search-pseudo-elements时,它会导致在网格中使用图标渲染行的性能降低100倍以上.奇怪的是网格虚拟化了行,所以实际上只有100行可见.没有此设置,渲染时间为.5秒.使用此设置时,它大于30秒,并且经常会崩溃浏览器.有问题的图标不是来自伪元素,但我在index.html中启用了此功能,以便在应用的其他部分进行有针对性的使用.

是否有任何方法可以使用伪类图标而不启用它,或将其范围仅限于某个区域?

svg font-awesome font-awesome-5

6
推荐指数
1
解决办法
1431
查看次数

Azure AD 登录 - 如果缓存帐户对于我的应用程序来说是错误的,如何允许用户更改 Azure 帐户

基本场景:Azure AD 仅用作 Web 应用程序的身份验证提供程序,从 azure 检索的身份通过电子邮件与本地身份进行匹配,并针对应用程序的 webapi 发出表单身份验证 cookie 以进行 api 授权。

问题:如果用户有多个 Azure 帐户,他们在访问我的应用程序时可能会经过预先身份验证。在这种情况下,当重定向回我的应用程序时,可能没有匹配的用户,并且登录无法完成。

所需的解决方案:如果缓存的 azure 帐户对我的应用程序无效,我想将用户引导回 Microsoft 登录页面,并有机会手动输入其凭据

我如何实现这一目标,这个流程有什么问题吗?目前,用户进入我的应用程序的唯一方法似乎是转到 azure 并注销错误帐户。还有哪些方法可以实现更好的用户体验?我是否应该使用 azure 的身份验证令牌并以编程方式注销用户,然后返回 azure 进行另一次操作?即使用户已经登录,我是否可以提示 azure 提示用户?

azure oauth-2.0 azure-active-directory openid-connect

5
推荐指数
1
解决办法
1496
查看次数

我可以禁用滚动ASP.net页面吗?

我在.aspx页面的顶部有一个html横幅,在它下面有一个silverlight应用程序.我希望该应用程序是单页体验,不允许任何滚动.问题是不同的浏览器具有不同的屏幕区域数量,因此在Firefox中横幅+应用程序可能适合页面而没有滚动条,但是IE9中的同一页面将有滚动条,因为没有足够的屏幕区域到在屏幕上显示.我的应用程序在底部设计了一个大的页脚来解决这个问题,但我需要页脚低于屏幕底部而不给用户选择向下滚动它.这可能吗?

asp.net scroll

1
推荐指数
1
解决办法
1万
查看次数