javascript - Sign in program not navigating properly, I think the issue is in the .js code and the placement of where it is -
sign in program not navigating properly, think issue in .js code , placement of is. have title, 2 text input boxes followed 2 buttons not work (the issue) navigation looks ok not working unfortunately. post .js in comments unfamiliar layout of posting issue.
<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <title>calorific calorie counter</title> <link href="lib/ionic/css/ionic.css" rel="stylesheet"> <link href="css/style.css" rel="stylesheet"> <link href="//code.ionicframework.com/nightly/css/ionic.css" rel="stylesheet"> <!--<script src="//code.ionicframework.com/nightly/js/ionic.bundle.js"></script>? <!-- if using sass (run gulp sass first), uncomment below , remove css includes above <link href="css/ionic.app.css" rel="stylesheet">--> <!-- ionic/angularjs js --> <script src="lib/ionic/js/ionic.bundle.js"></script> <!-- cordova script (this 404 during development) --> <script src="cordova.js"></script> <!-- app's js --> <script src="js/app.js"></script> </head> <body ng-app="calorific"> <ion-pane> <ion-header-bar class="bar-balanced"> <h1 class="title">calorific</h1> </ion-header-bar> <ion-content> <div class="list"> <label class="item item-input"> <span class="input-label">username</span> <input type="text" ng-model="user.username"> </label> <label class="item item-input"> <span class="input-label">password</span> <input type="password" ng-model="user.password"> </label> </div> <div class="padding"> <button class="button button-block button-balanced" ng-click="signin(user)"> sign-in </button> </div> <p class="text-center"> <a href="#/forgot-password">forgot password</a> </p> </ion-content> </ion-pane> <script id="templates/forgot-password.html" type="text/ng-template"> <ion-view view-title="forgot password"> <ion-content padding="true"> <p> text </p> <p> theres no username/password, click signin button signin view. </p> <p> return <a href="#/sign-in">sign-in</a>. </p> </ion-content> </ion-view> </script> <script id="templates/tabs.html" type="text/ng-template"> <ion-view> <ion-tabs class="tabs-icon-top tabs-positive"> <ion-tab title="home" icon="ion-home" href="#/tab/home"> <ion-nav-view name="home-tab"></ion-nav-view> </ion-tab> <ion-tab title="about" icon="ion-ios-information" href="#/tab/about"> <ion-nav-view name="about-tab"></ion-nav-view> </ion-tab> <ion-tab title="sign-out" icon="ion-log-out" href="#/sign-in"> </ion-tab> </ion-tabs> </ion-view> </script> <script id="templates/home.html" type="text/ng-template"> <ion-view view-title="home"> <ion-content padding="true"> <p>example of ionic tabs. </p> <p> <a class="button icon icon-right ion-chevron-right" href="#/tab/tester">tester text</a> </p> </ion-content> </ion-view> </script> <script id="templates/tester.html" type="text/ng-template"> <ion-view view-title="tester"> <ion-content padding="true"> <p>text</p> <p>text</p> <p>text</p> <p>text</p> <p>text</p> <p> <a class="button icon ion-home" href="#/tab/home"> home</a> <a class="button icon icon-right ion-chevron-right" href="#/tab/tester2">testert2</a> </p> </ion-content> </ion-view> </script> <script id="templates/tester2.html" type="text/ng-template"> <ion-view view-title="testert2"> <ion-content padding="true"> <p>text</p> <p>text</p> <p>text</p> <p>text</p> <p>text</p> <p>text</p> <p> <a class="button icon ion-home" href="#/tab/home"> home</a> <a class="button icon ion-chevron-left" href="#/tab/tester"> tester text</a> </p> </ion-content> </ion-view> </script> <script id="templates/about.html" type="text/ng-template"> <ion-view view-title="about"> <ion-content padding="true"> <h3>header</h3> <p>text</p> <p>text</p> <p> <a class="button icon icon-right ion-chevron-right" href="#/tab/navstack">tabs nav stack</a> </p> </ion-content> </ion-view> </script> <script id="templates/nav-stack.html" type="text/ng-template" <ion-view view-title="tab nav stack"> <ion-content padding="true"> <p><img src="http://ionicframework.com/img/diagrams/tabs-nav-stack.png" style="width:100%"></p> </ion-content> </ion-view> </script> </body> </html>
javascript:
angular.module('calorific', ['ionic']) .run(function($ionicplatform) { $ionicplatform.ready(function() { // hide accessory bar default (remove show accessory bar above keyboard // form inputs) if(window.cordova && window.cordova.plugins.keyboard) { cordova.plugins.keyboard.hidekeyboardaccessorybar(true); } if(window.statusbar) { statusbar.styledefault(); } }); }) .config(function($stateprovider, $urlrouterprovider) { $stateprovider .state('signin', { url: '/sign-in', templateurl: 'templates/sign-in.html', controller: 'signinctrl' }) .state('forgotpassword', { url: '/forgot-password', templateurl: 'templates/forgot-password.html' }) .state('tabs', { url: '/tab', abstract: true, templateurl: 'templates/tabs.html' }) .state('tabs.home', { url: '/home', views: { 'home-tab': { templateurl: 'templates/home.html', controller: 'hometabctrl' } } }) .state('tabs.tester', { url: '/tester', views: { 'home-tab': { templateurl: 'templates/tester.html' } } }) .state('tabs.tester2', { url: '/tester2', views: { 'home-tab': { templateurl: 'templates/tester2.html' } } }) .state('tabs.about', { url: '/about', views: { 'about-tab': { templateurl: 'templates/about.html' } } }) .state('tabs.navstack', { url: '/navstack', views: { 'about-tab': { templateurl: 'templates/nav-stack.html' } } }) .state('tabs.contact', { url: '/contact', views: { 'contact-tab': { templateurl: 'templates/contact.html' } } }); $urlrouterprovider.otherwise('/sign-in'); }) .controller('signinctrl', function($scope, $state) { $scope.signin = function(user) { console.log('sign-in', user); $state.go('tabs.home'); }; }) .controller('hometabctrl', function($scope) { console.log('hometabctrl'); });
as don't previde yet enough information, can assume.
do logs when click on button ? console.log('sign-in', user);
log hometab ? console.log('hometabctrl');
what error see in console ?
Comments
Post a Comment