Search code examples
angularjsjsfiddle

Why I get error module not available in JSFiddle?


I declare this module:

 angular.module('dashboard', [])
    .controller('dashboardController', ['$scope',
            function ($scope) {
                $scope.data = "555";
            }]);

And here is view:

<div ng-app="dashboard" data-role="page" id="layersProperty" data-add-back-btn="true" >
    <div ng-controller="dashboardController">
            {{data}}
    </div>
</div>

And here is FIDDLE.

In console I get this error:

Error: [$injector:nomod] Module 'dashboard' 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 idea why I get error above?


Solution

  • No issue with your code, since you are adding external scripts you just need to change

    Javascript settings -> Load type -> Wrap in <Head> enter image description here