3

I've created a project using the excellent aspnetboilerplate.com but i am trying to use it with my existing Angular project.

I am trying to setup the authentication features (user logging in, etc).

I've added the following packages to my package.json "abp-ng2-module" "abp-web-resources".

I've also added the relevant typescript files to my angular application.

When i look at the autogenerated project from aspnetboilerplate.com they are importing the modules like this:

import { PermissionCheckerService } from '@abp/auth/permission-checker.service';

However that doesn't work for me and VSCode reports that it can't find the module, i can import it like this :

import { PermissionCheckerService } from "abp-ng2-module/dist/src/auth/permission-checker.service";

When i try and build and run my app i get the following errors

TS2304: Cannot find name 'abp'.

the strange thing is this error show 5 or 6 times and not only relates to my local typescript files but also to the typescript files inside my packages.

ERROR in [at-loader] ./node_modules/abp-ng2-module/dist/src/features/feature-checker.service.d.ts:2:31 
TS2503: Cannot find namespace 'abp'.

It appears to be something around namespaces but i'm not sure why the installed package doesn't even work?

user2859298
  • 1,373
  • 3
  • 13
  • 28

1 Answers1

7

I had to create a custom typing file i.e. typings.d.ts and add the following lines.

///<reference path="../node_modules/abp-webresources/Abp/Framework/scripts/abp.d.ts"/>
///<reference path="../node_modules/abp-web-resources/Abp/Framework/scripts/libs/abp.jquery.d.ts"/>
///<reference path="../node_modules/abp-web-resources/Abp/Framework/scripts/libs/abp.signalr.d.ts"/>

I also added the following into my tsconfig.json file

"baseUrl": ".",
"paths": {
  "@abp/*": [ "../node_modules/abp-ng2-module/src/*" ],
  "@app/*": [ "./app/*" ],
  "@shared/*": [ "./shared/*" ],
  "@node_modules/*": [ "../node_modules/*" ]
}
user2859298
  • 1,373
  • 3
  • 13
  • 28