Simple requireJS with angularJS - angular is not defined

后端 未结 1 1586
隐瞒了意图╮
隐瞒了意图╮ 2021-01-05 21:30

I am new to requireJS, and I wanted to get a simple starter \'hello worldish\' project up and running. I\'m missing something though, because I get angular is not defi

相关标签:
1条回答
  • 2021-01-05 22:26

    You have not told the GreetCtrl that it depends upon angular thus it is undefined. Try changing the GreetCtrl to be like this

    define(['angular'], function(angular){
        angular.module( 'ReqApp.GreetCtrl', [])
        .controller( 'GreetCtrl', function GreetCtrl ($scope) {
             $scope.greeting = "greetings puny human";
        });
    });
    
    0 讨论(0)
提交回复
热议问题