小编Dha*_*n G的帖子

类'Subject <T>'错误地扩展了基类'Observable <T> Nativescript导航抽屉错误

#这是我现在面临的错误:

我使用npm(https://github.com/shripalsoni04/nativescript-angular-drawer-template)下载了导航抽屉样本.但它会出现以下错误.

dhrn@dhrn-Inspiron-5548:~/NativeApp/Supervisor$ tns run android

Searching for devices...
iTunes is not available for this operating system. You will not be able to work with connected iOS devices.
Executing before-prepare hook from /home/dhrn/NativeApp/Supervisor/hooks/before-prepare/nativescript-dev-typescript.js
Found peer TypeScript 2.4.1
node_modules/rxjs/Subject.d.ts(16,22): error TS2415: Class 'Subject<T>' incorrectly extends base class 'Observable<T>'.
  Types of property 'lift' are incompatible.
    Type '<R>(operator: Operator<T, R>) => Observable<T>' is not assignable to type '<R>(operator: Operator<T, R>) => Observable<R>'.
      Type 'Observable<T>' is not assignable to type 'Observable<R>'.
        Type …
Run Code Online (Sandbox Code Playgroud)

typescript nativescript angular2-nativescript nativescript-telerik-ui

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

Angular:如何获取路由器插座的组件实例

HTML:

<router-outlet></router-outlet>
Run Code Online (Sandbox Code Playgroud)

零件:

@Component({
      selector: 'xx',
      templateUrl: './xx.html',
      styleUrls: ['./xx.css'],
      providers: [ RouterOutlet]
    })
    export class AppComponent {
    constructor(private routeroutlet: RouterOutlet){ }
    getref() {
     console.log(this.routeroutlet);
     console.log('refresh', this.routeroutlet.component);
    }
}
Run Code Online (Sandbox Code Playgroud)

我收到了这个错误

core.es5.js:1224 ERROR Error: Outlet is not activated
    at RouterOutlet.get [as component] (router.es5.js:5449)
    at AppComponent.onRefreshscrum (app.component.ts:343)
    at Object.eval [as handleEvent] (AppComponent.ngfactory.js:111)
    at Object.handleEvent (core.es5.js:12251)
    at Object.handleEvent (core.es5.js:12975)
    at dispatchEvent (core.es5.js:8863)
    at eval (core.es5.js:11025)
    at SafeSubscriber.schedulerFn [as _next] (core.es5.js:3851)
    at SafeSubscriber.__tryOrUnsub (Subscriber.js:223)
    at SafeSubscriber.next (Subscriber.js:172)
Run Code Online (Sandbox Code Playgroud)

控制台结果:(this.routeroutlet)

RouterOutlet {
parentContexts: ChildrenOutletContexts, 
location: null, …
Run Code Online (Sandbox Code Playgroud)

angular-routing angular-ui-router angular2-routing angular

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