【问题标题】:Dependency injection in angular 1 typescript projectangular 1 typescript 项目中的依赖注入
【发布时间】:2017-01-15 04:56:21
【问题描述】:

我正在尝试在我的 angular1 项目中使用带有 typescript 的 angular-jwt。我安装了 angular-jwt 使用

typings install dt~angular-jwt --global

我在 typings>globals>angular-jwt 中有它,但 typings.json 文件中没有 angular-jwt。这是个问题吗?

我也得到错误:模块ngJwtAuth 不可用!虽然我尝试使用它作为依赖项。

import * as angular from 'angular';
import 'angular-jwt';

angular.module('app', ['ngJwtAuth']);

知道如何解决这个问题吗?

【问题讨论】:

    标签: javascript angularjs typescript dependency-injection jwt


    【解决方案1】:

    发生这种情况是因为未定义 ngJwtAuth 模块。

    模块的名称是angular-jwt,而不是ngJwtAuth

    typings.json 中缺少包是个问题,因为它不会为克隆的 repo 安装。将包保存在typings.jsonit should be

    typings install dt~angular-jwt --global --save
    

    【讨论】:

      猜你喜欢
      • 2015-08-28
      • 2016-07-19
      • 2020-02-13
      • 2013-04-10
      • 2020-03-14
      • 2021-12-31
      • 1970-01-01
      • 2020-02-05
      • 2020-01-08
      相关资源
      最近更新 更多