Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
“找不到模块:错误:无法使用Angular 6中的LinkedIN API解析'rxjs/add/operator/switchMap'”_Angular_Api_Rxjs_Linkedin_Angular6 - Fatal编程技术网

“找不到模块:错误:无法使用Angular 6中的LinkedIN API解析'rxjs/add/operator/switchMap'”

“找不到模块:错误:无法使用Angular 6中的LinkedIN API解析'rxjs/add/operator/switchMap'”,angular,api,rxjs,linkedin,angular6,Angular,Api,Rxjs,Linkedin,Angular6,我正在尝试在我的Angular应用程序中对LinkedIN API进行一个简单的API调用。我的API密钥和所有这些都是完美的。“我的应用程序/操作员无法解决此函数调用时出现以下错误:我的应用程序/操作员无法解决此错误” 我甚至加了一句话: import 'rxjs/add/operator/switchMap'; 到该组件的顶部 以下是我的component.ts总计: import { Component } from '@angular/core'; import { LinkedInS

我正在尝试在我的Angular应用程序中对LinkedIN API进行一个简单的API调用。我的API密钥和所有这些都是完美的。“我的应用程序/操作员无法解决此函数调用时出现以下错误:我的应用程序/操作员无法解决此错误”

我甚至加了一句话:

import 'rxjs/add/operator/switchMap';
到该组件的顶部

以下是我的component.ts总计:

import { Component } from '@angular/core';
import { LinkedInService } from 'angular-linkedin-sdk';
import 'rxjs/add/operator/switchMap';


@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent  {
  title = 'LItest';
  public apiKey;
  private basicProfileFields = ['id', 'first-name', 'last-name', 'maiden-name', 'formatted-name', 'phonetic-first-name', 'phonetic-last-name', 'formatted-phonetic-name', 'headline', 'location', 'industry', 'picture-url', 'positions'];
  public lastResponse;


  public constructor(private _linkedInService: LinkedInService) {
  }

  public rawApiCall(){
    const url = '/people/~?format=json';
    this._linkedInService.raw(url)
      .asObservable()
        .subscribe({
          next: (data) => {
            console.log(data);
          },
          error: (err) => {
            console.log(err);
          },
          complete: () => {
            console.log('RAW API call completed');
          }
        });
  }
}
尝试安装

npm安装-保存rxjs compat

尝试安装


npm安装-save rxjs compat

Angular6使用rxjs6.0.0+,为此,您可以通过从“rxjs/operators”导入{switchMap}来导入操作符,请参见我得到的另一个错误。这是一个确定的修复,我非常感谢随解决方案一起提供的文档。下一个错误是错误类型错误:This.isloadeobservable.switchMap不是FluentApiCall.push../node_modules/angular linkedin sdk/src/fluent.api.call.js.FluentApiCall.asobservable上的函数此包是基于rxjs5而不是rxjs6开发的。Angular6和这个软件包之间有冲突。不建议这样做,但是如果你不能等待,那么就从PR存储库中分叉,然后用npm从本地安装。Angular6使用rxjs6.0.0+,为此,你可以通过从“rxjs/operators”导入{switchMap}来导入操作符,请参阅我遇到了另一个错误。这是一个确定的修复,我非常感谢随解决方案一起提供的文档。下一个错误是错误类型错误:This.isloadeobservable.switchMap不是FluentApiCall.push../node_modules/angular linkedin sdk/src/fluent.api.call.js.FluentApiCall.asobservable上的函数此包是基于rxjs5而不是rxjs6开发的。Angular6与此软件包之间存在冲突。不建议使用此软件包,但如果您迫不及待,请从PR存储库中分叉,并使用npm从本地安装。