Add controllers
This commit is contained in:
parent
bd7abbe54d
commit
fc7848a43e
2 changed files with 34 additions and 5 deletions
|
@ -26,12 +26,12 @@
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
<li class="active"><a href="#">Finder</a></li>
|
<li class="active"><a href="#">Finder</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right" ng-controller="AuthCtrl">
|
||||||
<li ng-if="access_token == ''">
|
<li ng-if="access_token == ''">
|
||||||
<a href="#/login" class="dropdown-toggle" data-toggle="dropdown"><b>Login With Spotify</b></a>
|
<a href="#" ng-click="login()" class="dropdown-toggle" data-toggle="dropdown"><b>Login With Spotify</b></a>
|
||||||
</li>
|
</li>
|
||||||
<li ng-if="access_token != ''">
|
<li ng-if="access_token != ''">
|
||||||
<a href="#/refresh-token" class="dropdown-toggle" data-toggle="dropdown"><b>Refresh my token</b></a>
|
<a href="#" ng-click="refresh()" class="dropdown-toggle" data-toggle="dropdown"><b>Refresh my token</b></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div><!-- /.navbar-collapse -->
|
</div><!-- /.navbar-collapse -->
|
||||||
|
|
|
@ -37,9 +37,38 @@
|
||||||
$urlRouterProvider.otherwise("/");
|
$urlRouterProvider.otherwise("/");
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
app.run(['$rootScope',function($rootScope){
|
||||||
|
$rootScope.access_token = "";
|
||||||
|
$rootScope.refresh_token = "";
|
||||||
|
}]);
|
||||||
|
|
||||||
|
app.controller("HomeCtrl",['$scope',function($scope){
|
||||||
|
|
||||||
|
}]);
|
||||||
|
|
||||||
|
app.controller("MainCtrl",['$scope',function($scope){
|
||||||
|
|
||||||
|
}]);
|
||||||
|
|
||||||
|
app.controller("PlaylistCtrl",['$scope',function($scope){
|
||||||
|
|
||||||
|
}]);
|
||||||
|
|
||||||
|
app.controller("DupsCtrl",['$scope',function($scope){
|
||||||
|
|
||||||
|
}]);
|
||||||
|
|
||||||
app.controller('AuthCtrl',['$scope', '$rootScope', function($scope, $rootScope){
|
app.controller('AuthCtrl',['$scope', '$rootScope', function($scope, $rootScope){
|
||||||
$rootScope.access_token = "Bonjour";
|
$scope.login = function(){
|
||||||
$rootScope.refresh_token = "Bonjour2";
|
var openUrl = '/login';
|
||||||
|
window.$windowScope = $scope;
|
||||||
|
window.open(openUrl, "Authenticate Account", "width=500, height=500");
|
||||||
|
};
|
||||||
|
$scope.refresh = function(){
|
||||||
|
var openUrl = '/refresh_token';
|
||||||
|
window.$windowScope = $scope;
|
||||||
|
window.open(openUrl, "Authenticate Account", "width=500, height=500");
|
||||||
|
}
|
||||||
}])
|
}])
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in a new issue