Firebase和angularfire令牌登录

时间:2013-12-26 17:51:47

标签: angularjs firebase angularfire

因此尝试使用angularfire获取基本令牌Auth。登录后,我的页面传入一个firebase令牌。这就是我的角度:

var firetoken = mypassinvalue; //firebase token generated after login
var myApp = angular.module("MyApp", ["firebase", 'ngRoute']);
myApp.config(['$routeProvider', function($routeProvider) {
        $routeProvider.when('/', {
            template: '<h2> this is home</h2>',
            controller: 'menuCtrl',
            });

        $routeProvider.when('/allocations', {
            template: '<h2> this is allocations</h2>',
            controller: 'menuCtrl'
            });

        $routeProvider.otherwise({redirectTo: '/lost'});
        }])

myApp.controller("menuCtrl", ["$scope", "$firebaseAuth", function($scope, $firebaseAuth) {
        var ref = new Firebase("https://mybase.firebaseio.com/");
        $scope.auth = $firebaseAuth(ref);
        auth.$login(firetoken).then(function(user) {
            console.log('Logged in as: ', user);
            }, function(error) {
            console.error('Login failed: ', error);
            });
        }]);

所以我正在加载的错误是“TypeError:undefined不是函数”在这一行:$ scope.auth = $ firebaseAuth(ref);只是尝试使用我在http://angularfire.com/documentation.html

上找到的内容

0 个答案:

没有答案