It was a matter of scope it seems!
Moving bApp-related code out of the onDeviceReady function solved the problem.
题
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.