Getting Error - Cannot find name 'angular'

前端 未结 7 1579
野的像风
野的像风 2020-12-15 17:20

I\'m starting writing AngularJS app using TypeScript. I have this simple module command:

(() => {
    angular
        .module(\'app\', []);
})();
<         


        
7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-15 17:34

    Using AngularJS 1.x and TypeScript 2.x, I solved this issue by running:

    npm install --save-dev @types/angular
    

    and then include the following line on top of the .ts file:

    import * as angular from "angular";
    

    Reference: The Future of Declaration Files

提交回复
热议问题