There are many things in the code that you might want to take care of, but some quick and partially dirty solutions:
Do not include all of your javascript files in your nested templates. Everything directed to your ng-view should just be the html that you want to insert into this <div> . There are no CSS links, no script tags, nothing but HTML, which is usually located inside the body of the page.
On the registration page, your ng-model username should match what you pass as an argument to your ng-click . So instead of ng-model="userName" you need ng-model="userName" match ng-click="createUser(username, email, password)" .
Another important issue is that $scope overwritten every time you change views because each of your routes has the same controller. So you might think that the username (which you saved as the plural of $scope.usernames for some reason) is still available for you to access $scope . But this is not so, since each view runs on its own unique instance of Auth Controller. The quickest solution, since you donβt know how to implement the services, maybe insert $rootScope into your controller and then put usernames on $rootScope instead of $scope (although keep in mind using $rootScope in production is considered bad practice), since $ rootScope will be stored on all your controllers. So your javascript file will look like this:
app.controller("AuthCtrl", ["$scope", "$rootScope", "Auth", function($scope, $rootScope, Auth) {
and then
$scope.createUser = function(username, email, password) { $rootScope.usernames = username $scope.message = null; $scope.error = null;
source share