문제

I've been trying to build an app with Angularjs and Intel XDK, but it seems that XDK strips some tags from the html so Angularjs won't work.

Here's the code:

<script src='intelxdk.js'></script>
<script src='vendors/angular.js'></script>
<script type="text/javascript">
    var onDeviceReady=function(){
        intel.xdk.device.hideSplashScreen();
        var bApp = angular.module('bApp', []);
        bApp.controller('MenuCtrl', function ($scope) {
           $scope.test = 'Hello world!'; 
        });

    };
    document.addEventListener("intel.xdk.device.ready",onDeviceReady,false);
</script>

<div ng-app="bApp">
    <div id="MenuCtrl" ng-controller="MenuCtrl">
        {{test}}
    </div>

</div>

And here's the error message in the console:

Uncaught Error: [$injector:modulerr] Failed to instantiate module bApp 
due to: Error: [$injector:nomod] Module 'bApp' is not available! 
You either misspelled the module name or forgot to load it. 
If registering a module ensure that you specify the dependencies as 
the second argument.

Any ideas? Thanks

도움이 되었습니까?

해결책

It was a matter of scope it seems!

Moving bApp-related code out of the onDeviceReady function solved the problem.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top