Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
807 views
in Technique[技术] by (71.8m points)

javascript - 类型“订阅”缺少类型“可观察”的以下属性 <any> ':_isScalar,源,操作员,提升和另外6个(Type 'Subscription' is missing the following properties from type 'Observable<any>': _isScalar, source, operator, lift, and 6 more)

i need to return data from tow api in angular 8 .(我需要以角度8从拖曳api返回数据。)

i create this resolver :(我创建了这个解析器:) export class AccessLevelResolve implements Resolve<any>{ constructor(private accessLevel: AccessLevelService) { } resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<any> { let id = +route.paramMap.get('id'); const getControllerList = this.accessLevel.getAll().pipe( map( res => { if (res) { return res.date; } } ) ) const getRoleAccessRole = this.accessLevel.getAllWithId(id).pipe( map( res => { if (res) { return res.date; } } ) ) return forkJoin(getControllerList, getRoleAccessRole).subscribe(res => { return { controllerList: res[0], accessRoleList: res[1] } } ) } but it show me this error :(但是它告诉我这个错误:) Type 'Subscription' is missing the following properties from type 'Observable': _isScalar, source, operator, lift, and 6 more.(类型'Subscription'缺少类型'Observable'的以下属性:_isScalar,source,operator,lift和其他6个属性。) whats the problem ???(有什么问题 ???) how can i solve this problem ??(我怎么解决这个问题 ??)   ask by kianoush dortaj translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

you don't subscribe in your resolver, you return the observable and angular subscribes:(您没有在解析器中订阅,则返回可观察的和有角度的订阅:)

return forkJoin(getControllerList, getRoleAccessRole).pipe(map(res => { return { controllerList: res[0], accessRoleList: res[1] } }))

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...