Angular: Empty Fiddle

http://angularjs.org/

by boneskull

HTML

<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<div ng-controller="MyCtrl">

    <p>No events: {{eventCount}}</p>
    
    <script type="text/ng-template" id="view.html">
        <button ng-click="incrementClick()">Click me</button>
    </script>
    
  <div class="ng-view">
      
  </div>
    
</div>

JavaScript

var myApp = angular.module('myApp',[]);

//myApp.directive('myDirective', function() {});
//myApp.factory('myService', function() {});

function MyCtrl($scope) {
    $scope.eventCount = 0;
    $scope.incrementClick = function() {
        $scope.eventCount += 1;
    };
}

function ViewCtrl($scope) {
    
}

myApp.config(['$routeProvider', function($routeProvider){
    $routeProvider.when('/view', {templateUrl: 'view.html', controller: ViewCtrl}).
    otherwise({redirectTo: '/view'});
}]);