var myapp = angular.module('AppName', ['ui.router']); myapp.controller('OneController', function ($scope) { $scope.title = 'Just a text'; });
Minification compatible definition:
angular.module('AppName', ['ui.router']); angular.module('AppName') .controller('OneController', ['$scope', function($scope) { $scope.title = 'Just a text'; }]);
Test html:
<div ng-app="AppName" ng-controller="OneController"> {{title}} </div> <script src="http://code.angularjs.org/1.2.14/angular.min.js"></script> <script src="https://cdn.jsdelivr.net/angular.ui-router/1.0.0-alpha0/angular-ui-router.min.js"></script> <script> /* var myapp = angular.module('AppName', ['ui.router']); myapp.controller('OneController', function ($scope) { $scope.title = 'Just a text'; }); */ angular.module('AppName', ['ui.router']); angular.module('AppName') .controller('OneController', ['$scope', function($scope) { $scope.title = 'Just a text 2'; }]); </script>
On JSFiddle: https://jsfiddle.net/neptune001/afyyd6ob/
No comments:
Post a Comment