Jhankar Jhankar - 1 month ago 4
TypeScript Question

Dependency injection in angular 1 typescript project

I am trying to use angular-jwt with typescript in my angular1 project. I installed angular-jwt by using

typings install dt~angular-jwt --global

I have it in the typings>globals>angular-jwt but there is no angular-jwt in the
file. Is this a problem?

Also I get and error: Module
is not available! while i try to use it a dependency.

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

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

Any idea how to fix this?


This happens because ngJwtAuth module wasn't defined.

Module's name is angular-jwt, not ngJwtAuth.

The absence of a package in typings.json is a problem because it won't be installed for cloned repo. To save the package in typings.json it should be

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