小编Ene*_*sxg的帖子

将列表拆分为较小的等值列表

我希望将一个列表转换为相等值的较小列表。我有一个例子是:

["a", "a", "a", "b", "b", "c", "c", "c", "c"] 
Run Code Online (Sandbox Code Playgroud)

[["a", "a", "a"], ["b", "b"], ["c", "c", "c", "c"]]
Run Code Online (Sandbox Code Playgroud)

您认为最有效的方法是什么?

python

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

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

我试图在Angular应用程序中对LinkedIN API进行简单的API调用。我的API密钥以及所有这些都是完美的。由于某些原因,当我的应用程序调用此函数时,出现以下错误:“未找到模块:错误:无法解析'rxjs / add / operator / switchMap”

我什至添加了这一行:

import 'rxjs/add/operator/switchMap';
Run Code Online (Sandbox Code Playgroud)

到此组件的顶部。

这是我的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) => …
Run Code Online (Sandbox Code Playgroud)

api linkedin rxjs angular angular6

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

标签 统计

angular ×1

angular6 ×1

api ×1

linkedin ×1

python ×1

rxjs ×1