0

for example, can I do this?

angular.module('example')
    .controller('fooCtrl', function ($scope) {
    $scope.awesomeThings = [
        'HTML5 Boilerplate',
        'AngularJS',
        'Karma'];
})
    .when('/foo', {
    templateUrl: 'views/foo.html',
    controller: 'FooCtrl'
});

I'm asking because the part of the Yeoman AngularJS generator that generates routes does not set things up properly, and I'm trying to create a pull request that will fix the issue. JSHint checked the above code, and came back with no errors, so I'm hopeful. Can someone please point me in the right direction? Thank you for your time and consideration.

jalarast
  • 47
  • 5

1 Answers1

0

that won't work, it should be like this

angular.module('example',[])
    .config(function($routeProvider){
$routeProvider

})
    .when('/foo', {
    templateUrl: 'views/foo.html',
    controller: 'fooCtrl'
})
.controller('fooCtrl', function ($scope) {
    $scope.awesomeThings = [
        'HTML5 Boilerplate',
        'AngularJS',
        'Karma'];
});
z.a.
  • 2,549
  • 3
  • 12
  • 16