Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .config(function($stateProvider, $urlRouterProvider) {
- $stateProvider
- .state('app', {
- url: '/app',
- abstract: true,
- templateUrl: 'templates/menu.html'
- })
- .state('app.login', {
- url: '/login',
- views: {
- 'menuContent': {
- templateUrl: 'templates/login.html',
- controller: 'AppCtrl'
- }
- },
- authenticate: false
- })
- .state('app.search', {
- url: '/search',
- views: {
- 'menuContent': {
- templateUrl: 'templates/search.html',
- controller: 'mainCtrl'
- }
- }
- })
- .state('app.browse', {
- url: '/browse',
- views: {
- 'menuContent': {
- templateUrl: 'templates/browse.html',
- controller: 'mainCtrl'
- }
- }
- })
- .state('app.playlists', {
- url: '/playlists',
- views: {
- 'menuContent': {
- templateUrl: 'templates/playlists.html',
- controller: 'PlaylistsCtrl'
- }
- }
- })
- .state('app.snapshot', {
- url: '/snapshot',
- views: {
- 'menuContent': {
- templateUrl: 'templates/snapshot.html'
- }
- }
- })
- .state('app.callqueues', {
- url: '/callqueues',
- views: {
- 'menuContent': {
- templateUrl: 'templates/callqueues.html'
- }
- }
- })
- .state('app.single', {
- url: '/playlists/:playlistId',
- views: {
- 'menuContent': {
- templateUrl: 'templates/playlist.html',
- controller: 'PlaylistCtrl'
- }
- }
- });
- // if none of the above states are matched, use this as the fallback
- // $urlRouterProvider.otherwise('/app/search');
- $urlRouterProvider.otherwise('/app/login');
- });
- angular.module('starter.controllers', [])
- .controller('AppCtrl', function($scope, $ionicModal, $timeout, $location, $http, $log, $state) {
- // With the new view caching in Ionic, Controllers are only called
- // when they are recreated or on app start, instead of every page change.
- // To listen for when this page is active (for example, to refresh data),
- // listen for the $ionicView.enter event:
- //$scope.$on('$ionicView.enter', function(e) {
- //});
- // Form data for the login modal
- $scope.loginData = {};
- // Create the login modal that we will use later
- // $ionicModal.fromTemplateUrl('templates/login.html', {
- // scope: $scope
- // }).then(function(modal) {
- // $scope.modal = modal;
- // });
- // Triggered in the login modal to close it
- // $scope.closeLogin = function() {
- // $scope.modal.hide();
- // };
- // Open the login modal
- // $scope.login = function() {
- // $scope.modal.show();
- // };
- $scope.chartConfig = {
- options: {
- chart: {
- type: 'bar'
- }
- },
- series: [{
- data: [10, 15, 12, 8, 7]
- }],
- title: {
- text: 'Hello'
- },
- loading: false
- };
- // Perform the login action when the user submits the login form
- $scope.doLogin = function() {
- console.log('Doing login', $scope.loginData);
- var username = $scope.loginData.name;
- var password = $scope.loginData.password;
- console.log("username" + $scope.loginData.name);
- if (username == "admin@as" && password == "admin") {
- console.log("if part");
- $location.path("#/app/search");
- } else {
- console.log("error");
- // $("#errorpwd").css({"display":"block"});
- // $scope.message = "Error";
- // $scope.messagecolor = "alert alert-danger";
- }
- // Simulate a login delay. Remove this and replace with your login
- // code if using a login system
- // $timeout(function() {
- // $scope.closeLogin();
- // }, 1000);
- };
- })
- <ion-view view-title="Login" name="login-view">
- <ion-header-bar class="bar bar-header bar-positive">
- <h1 class="title">Login</h1>
- <!--<button class="button button-clear button-primary icon-left ion-close-circled" ng-click="modal.hide()"></button>-->
- </ion-header-bar>
- <ion-content>
- <form ng-submit="doLogin()">
- <div class="list">
- <label class="item item-input">
- <span class="input-label">Username</span>
- <input type="text" ng-model="loginData.name">
- </label>
- <label class="item item-input">
- <span class="input-label">Password</span>
- <input type="password" ng-model="loginData.password">
- </label>
- <label class="item">
- <button nav-clear class="button button-block button-positive" type="submit">Log in</button>
- </label>
- </div>
- </form>
- </ion-content>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement