controllers created
This commit is contained in:
parent
2fab69cfdc
commit
84db0f96b1
|
@ -30,8 +30,9 @@
|
|||
<script src="/js/app.js" charset="utf-8"></script>
|
||||
<!-- Services -->
|
||||
<script src="/js/services/contacts.js" charset="utf-8"></script>
|
||||
<script src="/js/services/auth.js" charset="utf-8"></script>
|
||||
<!-- Controllers -->
|
||||
<script src="/js/controllers/loginController.js" charset="utf-8"></script>
|
||||
<script src="/js/controllers/signInController.js" charset="utf-8"></script>
|
||||
<script src="/js/controllers/homeController.js" charset="utf-8"></script>
|
||||
<script src="/js/controllers/boltController.js" charset="utf-8"></script>
|
||||
<script src="/js/controllers/filesController.js" charset="utf-8"></script>
|
||||
|
|
23
js/app.js
23
js/app.js
|
@ -3,13 +3,15 @@
|
|||
var app = angular.module('launchpad', ['ui.router']);
|
||||
|
||||
app.config(function($stateProvider, $urlRouterProvider){
|
||||
$urlRouterProvider.otherwise('/login');
|
||||
$urlRouterProvider.otherwise('/sign-in');
|
||||
$stateProvider
|
||||
.state('app',{
|
||||
url: '/',
|
||||
views: {
|
||||
'header': {
|
||||
templateUrl: '/templates/partials/header.html'
|
||||
templateUrl: '/templates/partials/header.html',
|
||||
controller: 'HomeController',
|
||||
controllerAs: 'vm'
|
||||
},
|
||||
'menu': {
|
||||
templateUrl: '/templates/partials/menu.html'
|
||||
|
@ -27,16 +29,23 @@ app.config(function($stateProvider, $urlRouterProvider){
|
|||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'templates/home.html',
|
||||
controller: 'HomeController'
|
||||
controller: 'HomeController',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('app.login', {
|
||||
url: 'login',
|
||||
.state('app.sign-in', {
|
||||
url: 'sign-in',
|
||||
views: {
|
||||
'content@': {
|
||||
templateUrl: 'templates/login.html',
|
||||
controller: 'LoginController'
|
||||
templateUrl: 'templates/sign-in.html',
|
||||
controller: 'SignInController',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
},
|
||||
resolve: {
|
||||
loginStatus: function(authService) {
|
||||
return authService.getUser();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
app.controller('EmailController', function($scope) {
|
||||
app.controller('EmailController', [function($scope) {
|
||||
|
||||
});
|
||||
}]);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
app.controller('HomeController', function($scope) {
|
||||
app.controller('HomeController', ['$scope', function ($scope) {
|
||||
var vm = this;
|
||||
|
||||
});
|
||||
}]);
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
app.controller('BoltController', function($scope) {
|
||||
app.controller('BoltController', [function($scope) {
|
||||
|
||||
});
|
||||
}]);
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
app.controller('ContactController', function($scope, ContactsService) {
|
||||
app.controller('ContactController', ['$scope', function($scope) {
|
||||
$scope.contacts = ContactsService.list();
|
||||
});
|
||||
}]);
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
app.controller('ContactDetailController', function($scope, $stateParams, ContactsService) {
|
||||
app.controller('ContactDetailController', ['$scope', '$stateParams', 'ContactsService', function($scope, $stateParams, ContactsService) {
|
||||
$scope.selected = ContactsService.find($stateParams.id);
|
||||
});
|
||||
}]);
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
app.controller('DnsController', function($scope) {
|
||||
app.controller('DnsController', [function($scope) {
|
||||
|
||||
});
|
||||
}]);
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
app.controller('FilesController', function($scope) {
|
||||
app.controller('FilesController', [function($scope) {
|
||||
|
||||
});
|
||||
}]);
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
app.controller('LoginController', function($scope) {
|
||||
|
||||
});
|
|
@ -1,3 +1,3 @@
|
|||
app.controller('MusicController', function($scope) {
|
||||
app.controller('MusicController', [function($scope) {
|
||||
|
||||
});
|
||||
}]);
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
app.controller('SignInController', ['$scope', 'loginStatus', '$location', function ($scope, loginStatus, $location) {
|
||||
var vm = this;
|
||||
vm.userProfile = {};
|
||||
// vm.message = loginStatus;
|
||||
|
||||
vm.sign_in = function() {
|
||||
vm.userProfile.email = vm.userAuthEmail;
|
||||
vm.userProfile.password = vm.userAuthPassword;
|
||||
if (vm.userProfile.email === loginStatus.email && vm.userProfile.password === loginStatus.password) {
|
||||
console.log('yes!');
|
||||
$location.path('/home');
|
||||
} else {
|
||||
alert("wrong")
|
||||
}
|
||||
};
|
||||
|
||||
}]);
|
|
@ -1,3 +1,3 @@
|
|||
app.controller('WebsiteController', function($scope) {
|
||||
app.controller('WebsiteController', [function($scope) {
|
||||
|
||||
});
|
||||
}]);
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
app.factory('authService', function($q){
|
||||
return {
|
||||
getUser: function(){
|
||||
var user = {
|
||||
email: 'jane@doe.com',
|
||||
password: 'password'
|
||||
}
|
||||
return $q.when(user);
|
||||
}
|
||||
};
|
||||
});
|
|
@ -1,4 +1,4 @@
|
|||
app.factory('ContactsService',function(){
|
||||
app.factory('ContactsService', [function(){
|
||||
var contacts = [
|
||||
{
|
||||
id: 1,
|
||||
|
@ -30,4 +30,4 @@ app.factory('ContactsService',function(){
|
|||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
}]);
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
</form>
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-user" aria-hidden="true"></i> <span class="caret"></span></a>
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ vm.message }} <i class="fa fa-user" aria-hidden="true"></i> <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="feed.html" target="_blank">Preview My Public Site</a></li>
|
||||
<li><a>Account Settings</a></li>
|
||||
|
|
|
@ -1,60 +1,60 @@
|
|||
<div class="side-menu">
|
||||
<div class="button-container">
|
||||
<div class="button-container" ui-sref-active="active">
|
||||
<a ui-sref=".home">
|
||||
<button type="button" name="button" class="btn btn-default side-menu-button"><i class="fa fa-home fa-2x" aria-hidden="true"></i></button>
|
||||
<p class="button-title">Home</p>
|
||||
</a>
|
||||
</div>
|
||||
<div class="button-container">
|
||||
<div class="button-container" ui-sref-active="active">
|
||||
<a ui-sref=".bolt">
|
||||
<button type="button" name="button" class="btn btn-default side-menu-button"><i class="fa fa-bolt fa-2x" aria-hidden="true"></i></button>
|
||||
<p class="button-title">Bolt</p>
|
||||
</a>
|
||||
</div>
|
||||
<div class="button-container">
|
||||
<div class="button-container" ui-sref-active="active">
|
||||
<a ui-sref=".contacts">
|
||||
<button type="button" name="button" class="btn btn-default side-menu-button"><i class="fa fa-users fa-2x" aria-hidden="true"></i></button>
|
||||
<p class="button-title">Contacts</p>
|
||||
</a>
|
||||
</div>
|
||||
<div class="button-container">
|
||||
<div class="button-container" ui-sref-active="active">
|
||||
<a ui-sref=".files">
|
||||
<button type="button" name="button" class="btn btn-default side-menu-button"><i class="fa fa-file-text-o fa-2x" aria-hidden="true"></i></button>
|
||||
<p class="button-title">Files</p>
|
||||
</a>
|
||||
</div>
|
||||
<div class="button-container">
|
||||
<div class="button-container" ui-sref-active="active">
|
||||
<a ui-sref=".music">
|
||||
<button type="button" name="button" class="btn btn-default side-menu-button"><i class="fa fa-music fa-2x" aria-hidden="true"></i></button>
|
||||
<p class="button-title">Music</p>
|
||||
</a>
|
||||
</div>
|
||||
<div class="button-container">
|
||||
<div class="button-container" ui-sref-active="active">
|
||||
<a ui-sref=".email">
|
||||
<button type="button" name="button" class="btn btn-default side-menu-button"><i class="fa fa-envelope-o fa-2x" aria-hidden="true"></i></button>
|
||||
<p class="button-title">Email</p>
|
||||
</a>
|
||||
</div>
|
||||
<div class="button-container">
|
||||
<div class="button-container" ui-sref-active="active">
|
||||
<a ui-sref=".website">
|
||||
<button type="button" name="button" class="btn btn-default side-menu-button"><i class="fa fa-globe fa-2x" aria-hidden="true"></i></button>
|
||||
<p class="button-title">Website</p>
|
||||
</a>
|
||||
</div>
|
||||
<div class="button-container">
|
||||
<div class="button-container" ui-sref-active="active">
|
||||
<a ui-sref=".dns">
|
||||
<button type="button" name="button" class="btn btn-default side-menu-button"><i class="fa fa-connectdevelop fa-2x" aria-hidden="true"></i></button>
|
||||
<p class="button-title">DNS</p>
|
||||
</a>
|
||||
</div>
|
||||
<!--
|
||||
<div class="button-container">
|
||||
<div class="button-container" ui-sref-active="active">
|
||||
<a ui-sref=".sync">
|
||||
<button type="button" name="button" class="btn btn-default side-menu-button"><i class="fa fa-tablet fa-2x" aria-hidden="true"></i></button>
|
||||
<p class="button-title">Sync</p>
|
||||
</a>
|
||||
</div>
|
||||
<div class="button-container">
|
||||
<div class="button-container" ui-sref-active="active">
|
||||
<a ui-sref=".photo">
|
||||
<button type="button" name="button" class="btn btn-default side-menu-button"><i class="fa fa-picture-o fa-2x" aria-hidden="true"></i></button>
|
||||
<p class="button-title">Photo</p>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class="alert alert-success" role="alert">
|
||||
<i class="fa fa-check"></i>
|
||||
<span class="sr-only">Congrats:</span>
|
||||
Something cool
|
||||
Cool Story Bro...
|
||||
</div>
|
||||
|
|
|
@ -7,10 +7,5 @@
|
|||
<label for="exampleInputPassword1">Password</label>
|
||||
<input type="password" class="form-control" placeholder="Password" ng-model="vm.userAuthPassword">
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox"> Remember me
|
||||
</label>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default" ng-click="vm.submit()">Submit</button>
|
||||
<button type="submit" class="btn btn-default" ng-click="vm.sign_in()">Submit</button>
|
||||
</form>
|
Loading…
Reference in New Issue