user3547774
user3547774

Reputation: 1689

TypeScript trying to use adaljs

I am developing an application using Angular2 with TypeScript. Part of that requires the use of ADALJS. As I understand I cannot use the angular part in this library since it only supports Angular1, so I plan to use just adal.js. My question around this is

  1. I installed definitelytyped from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/24295668a2e66f9daed4e383e22074d8452505a1/adal-angular (adal.d.ts)

  2. Into my login component I added ///</// <reference path="adal.d.ts" />

  3. Onto the top of the class (component) I added

    import * as adal from "adal-angular/dist/adal.min";

However when I run the application I get an error

angular2-polyfills.js:1243 Error: XHR error (404 Not Found) loading http://localhost:3000/adal-angular/dist/adal.min.js(…)

How do I fix this?

Upvotes: 1

Views: 1439

Answers (2)

hannes neukermans
hannes neukermans

Reputation: 13327

try using adal-ts

npm install adal-ts --save

Upvotes: 1

Corey Ford
Corey Ford

Reputation: 145

Adding the reference to the type definitions (adal.d.ts) is not the same as adding a reference to adal.js itself.

To reference the file from a CDN, add to your html:

<script src="https://secure.aadcdn.microsoftonline-p.com/lib/1.0.11/js/adal.min.js"></script>

Or, you could install adal-angular package from NPM:

npm install adal-angular

See https://github.com/AzureAD/azure-activedirectory-library-for-js for more information.

Upvotes: 0

Related Questions