Search code examples
javascriptangularjsangularjs-scopeangularjs-controller

Simple Angular code not working


HTML

<section ng-app="app">
     <table ng-controller="VoicemailsCtrl">
        <caption>{{test}}</caption>
    </table>
</section>

JS

var app = angular.module('app', [])
              .controller('VoicemailsCtrl', ['$scope', VoicemailsCtrl]);

function VoicemailsCtrl($scope, $http)
{
    $scope.vms = [1,2,3];
    $scope.test = 'this is a test';
}

Can be seen at:

http://jsfiddle.net/tx9nbo8g/6/


Solution

  • You missed adding ng-app="app" in the section.

    Check the updated fiddle Fiddle

    Apart from this you need to add

    angular 1.2.1

    and

    No wrap in head

    in framework and extension. .