angularjs - Can't log in/out or register, and my submitPost function stopped working -
grunt gives me no errors
and under debugger
"error: [$injector:unpr] unknown provider: authprovider <- auth <- user <- navctrl
and
"error: [$injector:unpr] unknown provider: authprovider <- auth <- user
this auth service https://github.com/eibonic/angularjs-reddit/blob/master/app/scripts/services/auth.js
and nav controller
'use strict'; app.controller('navctrl', function ($scope, $location, post, auth){ $scope.post = {url: 'http://', title: ''}; $scope.signedin = auth.signedin; $scope.submitpost = function () { post.create($scope.post).then(function (ref){ $scope.post = {url: 'http://', title: ''}; $location.path('/posts/' + ref.name()); }); }; $scope.logout = function () { auth.logout(); }; });
and auth controller.
'use strict'; app.controller('authctrl', function ($scope, $location, auth) { if (auth.signedin()) { $location.path('/'); } $scope.login = function () { auth.login($scope.user).then(function () { $location.path('/'); }); }; $scope.register = function () { auth.register($scope.user).then(function () { return auth.login($scope.user).then(function() { $location.path('/'); }); }); }; });
this tutorial i'm using reference , things started breaking after added auth functions. https://thinkster.io/learn-to-build-realtime-webapps/
clicking submit nothing. , when click logout/register/login, url changes that's it.
have included following files in index.html?
<script src="scripts/services/auth.js"></script> <script src="scripts/controllers/auth.js"></script>
Comments
Post a Comment