My structrure is below. I have a very simple example of requireJS but i stack to the most important. I can't seperate angular controller from bootstrap.js file. I want to help me complete my first example to understand it. Thank you
- javascripts/bootstrap.js
- javascripts/main.js
- index.php
index.php
<!DOCTYPE HTML>
<html>
<head>
<title>RequireJS</title>
<script data-main="javascripts/main" src="require.js"></script>
</head>
<body>
<div ng-app="app" ng-controller="hello">
{{sayHello()}}
</div>
</body>
</html>
main.js
require.config({
baseUrl: "javascripts",
paths: {
'angular': 'https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min'
},
shim: {
'angular': {
exports: 'angular'
}
},
deps: ['./bootstrap']
});
bootstrap.js
require(["angular"],function(angular){
var app = angular.module('app',[]);
app.controller("hello",
function($scope) {
$scope.sayHello = function() {
return "Hello";
}
}
);
return app;
})
angular.bootstrap(document, ['app']);
– David Chase Mar 10 at 19:25