When using controller syntax , you also need to change all routes that used a function reference to use a string reference
Interesting : using a string reference will also work when defining global controller functions, but for now, it is best to use .controller syntax and avoid global functions .. p>
var myProject = angular.module('project', ['firebase']). value('fbURL', 'https://angularjs-projects.firebaseio.com/'). factory('Projects', function(angularFireCollection, fbURL) { return angularFireCollection(fbURL); }). config(function($routeProvider) { $routeProvider. when('/', {controller:'ListCtrl', templateUrl:'list.html'}). otherwise({redirectTo:'/'}); }); // function ListCtrl($scope, Projects) { // $scope.projects = Projects; // } // next 3 lines will work myProject.controller('ListCtrl', ['$scope', 'Projects', function ($scope, Projects) { $scope.projects = Projects; }]);
source share