Angularjs Uncaught Error: [$injector:modulerr] when migrating to V1.3

前端 未结 4 485
我寻月下人不归
我寻月下人不归 2020-11-22 10:47

I am learning Angular.js and I am not able to figure out whats wrong with this simple code. It seems to look fine but giving me following error.



        
4条回答
  •  名媛妹妹
    2020-11-22 11:10

    I was myself stuck in this issue for sometime. Check for following in order:-

    1. The path to you angular.js script is correct (whether you are calling it in your HTML from a local source or as an external resource).

    2. Next, once your angular.js is correct check if your app is initialized or not.

      var app=angular.module('app',[])//in your app.js file

      //in your html

    3. Next register your controller with the app and pass in all necessary injections

      app.controller('myCtrl',function(){});

    4. Call your javascript file in your html file

提交回复
热议问题