Getting Error - Cannot find name 'angular'

前端 未结 7 1555
野的像风
野的像风 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:37

    You could simplistically tell the compiler to stop worrying by telling it that "you know all about angular":

    declare var angular: any;
    

    To get all the good tooling and type checking, you need to pull in the Angular type definition so the compiler knows what is available.

    The type definitions are available via NuGet if you are using Visual Studio or various other methods for your favourite IDE.

提交回复
热议问题