Search code examples
angularjsjsfiddle

can't get AngularJS working in JSFiddle


This extremely simple JSFiddle will not display the message. Instead, it displays {{message}}. Why isn't it working? http://jsfiddle.net/vf6qushc/5/

Here is the HTML:

<html ng-app="root">
  <div ng-controller="index">
    <div>{{message}}</div>
  </div>
</html>

Here is the JS/AngularJS:

angular.module('root', [])
    .controller("index", ['$scope', function ($scope) {
        $scope.message = "Hello World!";
    }]);

Solution

  • Problem was at your JavaScript loading. Remove On Load from here and it will work:

    enter image description here

    Change to this: enter image description here

    angular.module('root', [])
        .controller("index", ['$scope', function ($scope) {
            $scope.message = "Hello World!";
        }]);
    

    Working JSFIDDLE here : http://jsfiddle.net/mrjz386y/