小编Jon*_*han的帖子

Angular TypeError:_angular_core__WEBPACK_IMPORTED_MODULE_1__.??defineInjectable 不是函数

我正在运行我的应用程序LiveCicle,当我导航到地图路线时,出现此错误:

\n\n
ERROR Error: Uncaught (in promise): TypeError: _angular_core__WEBPACK_IMPORTED_MODULE_1__.\xc9\xb5\xc9\xb5defineInjectable is not a function\nTypeError: _angular_core__WEBPACK_IMPORTED_MODULE_1__.\xc9\xb5\xc9\xb5defineInjectable is not a function\n    at tm.service.ts:9\n
Run Code Online (Sandbox Code Playgroud)\n\n

这很奇怪,因为我将 tm 服务定义为路由模块中的提供者。

\n\n
@NgModule({\n providers: [\n    {\n      provide:\n        HTTP_INTERCEPTORS\n      ,\n\n      useClass: AuthInterceptor,\n      multi: true\n    },\n    TicketMasterService\n  ],\n})\n
Run Code Online (Sandbox Code Playgroud)\n\n
const routes: Routes = [\n  {path: \'map\',   loadChildren: () => import(\'./event-map-page/event-map-page.module\').then(m => m.EventMapPageModule)},\n\n  {path: \'**\', redirectTo: \'\', pathMatch: \'full\'},\n\n];\n\n@NgModule({\n  imports: [RouterModule.forRoot(routes)],\n  exports: [RouterModule]\n})\nexport class AppRoutingModule { }\n
Run Code Online (Sandbox Code Playgroud)\n\n

我只在生产中遇到此错误。当我在本地运行时,一切正常。

\n\n
import { Injectable, OnInit } from \'@angular/core\';\nimport { …
Run Code Online (Sandbox Code Playgroud)

lazy-loading typescript webpack angular

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

在 Angular 8 中实现 Swiper

我正在尝试在我的 Angular 8 应用程序中实现Swiperhttps : //swiperjs.com/get-started/

我在我的资产文件夹中创建了一个 javascript 文件并将它包含到我的angular.json.

此外,我在我的中包含了Swiperapp.module.ts并运行了命令 npm install @types/swiper.

但是,我收到错误:

[ts] Module '"../node_modules/@types/swiper/index has no exported member 'Swiper'

当它清楚地这样做时。我不确定我哪里出错了。

card-swipe.component.ts

import { SwiperModule, SwiperConfigInterface } from 'ngx-swiper-wrapper';



@Component({
  selector: 'app-card-swipe',
  templateUrl: './card-swipe.component.html',
  styleUrls: ['./card-swipe.component.css']
})
export class CardSwipeComponent implements OnInit {


constructor() { }
something;
index;
config: SwiperConfigInterface = {
  a11y: true,
  direction: 'horizontal',
  slidesPerView: 3,
  slideToClickedSlide: true,
  mousewheel: true,
  scrollbar: false,
  watchSlidesProgress: true,
  navigation: true, …
Run Code Online (Sandbox Code Playgroud)

npm swiper angular

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

标签 统计

angular ×2

lazy-loading ×1

npm ×1

swiper ×1

typescript ×1

webpack ×1