@@ -307,7 +307,7 @@ app.config(["$routeProvider", function($routeProvider) {
307307 templateUrl: " views/home.html" ,
308308 resolve: {
309309 // controller will not be loaded until $waitForSignIn resolves
310- // Auth refers to our $firebaseAuth wrapper in the example above
310+ // Auth refers to our $firebaseAuth wrapper in the factory below
311311 " currentAuth" : [" Auth" , function (Auth ) {
312312 // $waitForSignIn returns a promise so the resolve waits for it to complete
313313 return Auth .$waitForSignIn ();
@@ -319,7 +319,7 @@ app.config(["$routeProvider", function($routeProvider) {
319319 templateUrl: " views/account.html" ,
320320 resolve: {
321321 // controller will not be loaded until $requireSignIn resolves
322- // Auth refers to our $firebaseAuth wrapper in the example above
322+ // Auth refers to our $firebaseAuth wrapper in the factory below
323323 " currentAuth" : [" Auth" , function (Auth ) {
324324 // $requireSignIn returns a promise so the resolve waits for it to complete
325325 // If the promise is rejected, it will throw a $stateChangeError (see above)
@@ -338,6 +338,12 @@ app.controller("AccountCtrl", ["currentAuth", function(currentAuth) {
338338 // currentAuth (provided by resolve) will contain the
339339 // authenticated user or null if not signed in
340340}]);
341+
342+ app .factory (" Auth" , [" $firebaseAuth" ,
343+ function ($firebaseAuth ) {
344+ return $firebaseAuth ();
345+ }
346+ ]);
341347```
342348
343349### ` ui-router ` Example
@@ -362,7 +368,7 @@ app.config(["$stateProvider", function ($stateProvider) {
362368 templateUrl: " views/home.html" ,
363369 resolve: {
364370 // controller will not be loaded until $waitForSignIn resolves
365- // Auth refers to our $firebaseAuth wrapper in the example above
371+ // Auth refers to our $firebaseAuth wrapper in the factory below
366372 " currentAuth" : [" Auth" , function (Auth ) {
367373 // $waitForSignIn returns a promise so the resolve waits for it to complete
368374 return Auth .$waitForSignIn ();
@@ -375,7 +381,7 @@ app.config(["$stateProvider", function ($stateProvider) {
375381 templateUrl: " views/account.html" ,
376382 resolve: {
377383 // controller will not be loaded until $requireSignIn resolves
378- // Auth refers to our $firebaseAuth wrapper in the example above
384+ // Auth refers to our $firebaseAuth wrapper in the factory below
379385 " currentAuth" : [" Auth" , function (Auth ) {
380386 // $requireSignIn returns a promise so the resolve waits for it to complete
381387 // If the promise is rejected, it will throw a $stateChangeError (see above)
@@ -394,6 +400,12 @@ app.controller("AccountCtrl", ["currentAuth", function(currentAuth) {
394400 // currentAuth (provided by resolve) will contain the
395401 // authenticated user or null if not signed in
396402}]);
403+
404+ app .factory (" Auth" , [" $firebaseAuth" ,
405+ function ($firebaseAuth ) {
406+ return $firebaseAuth ();
407+ }
408+ ]);
397409```
398410Keep in mind that, even when using ` ng-annotate ` or ` grunt-ngmin ` to minify code, that these tools
399411cannot peer inside of functions. So even though we don't need the array notation to declare our
0 commit comments