Currently, I am in the process of developing an application using TypeScript along with AngularJS. However, I have encountered the following error:
Error: [$injector:nomod] Module 'app' is not available! It seems that either there is a typo in the module name or it has not been loaded properly. When registering a module, ensure that you specify the dependencies as the second argument.
The content of app.ts is shown below:
import * as angular from 'angular';
import IModule = ng.IModule;
export class App{
public static bootstrap():void{
const app : IModule = angular.module('app',).component('sachin',{
template:'<div>sdafdsfa</div>',
controller:[function(){
}],
controllerAs:'vm'
})
angular.bootstrap(document, ["app"], {
"strictDi": true,
});
}
}
The content of index.html is as follows:
<!DOCTYPE html>
<html lang="en" ng-app="app" >
<head>
<title>My AngularJS App with ts</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<sachin></sachin>
<script src="vendors.js"></script>
<script src="bundle.js"></script>
</body>
</html>