javascript - ion-view doesn't appear inside ion-nav-view -
after having done few tutorials, i'm getting started own ionic app. got start ionic's blank template. problem ion-view (in cards.js, see below) doesn't show @ inside ion-nav-view, i.e. don't child html tag ion-nav-view.
i used adam's answer this question make sure routes correctly setup, , don't error, think are. i'm not trying have tabs, 1 view.
if place breakpoint inside controller function, execution isn't paused apparently code not executed @ all, have trouble going deeper guts of framework figure out what's going on.
do have idea i'm missing/doing wrong here ?
my code is:
index.html
<!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></title> <link href="lib/ionic/css/ionic.css" rel="stylesheet"> <link href="css/style.css" rel="stylesheet"> <!-- 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> <!-- libs--> <script src="lib/ionic-contrib-tinder-cards/ionic.tdcards.js"></script> <script src="lib/collide/collide.js"></script> <!-- app's js --> <script src="app/app.js"></script> <script src="app/controllers/cards.js"></script> </head> <body ng-app="myapp"> <ion-nav-view></ion-nav-view> </body> </html> app.js
angular.module('myapp', ['ionic']) .run(function($ionicplatform, $rootscope) { $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('cards', { url: '/cards', views: { 'cards': { templateurl: 'app/views/cards.html', controller: 'cards' } } }); $urlrouterprovider.otherwise('/cards'); }); cards.js
angular.module('myapp') .controller('cards', function($scope) { $scope.cards = [ {title: 'card-1'}, {title: 'card-2'}, {title: 'card-3'} ]; }); cards.html
<ion-view view-title="cards"> <ion-content ng-controller="cards"> <h1> cards view </h1> <ion-list> <ion-item ng-repeat="cards in cards"> {{card.title}} </ion-item> </ion-list> </ion-content> </ion-view>
i have deleted previous post, pointed out reply totally wrong.
concerning routing , here mine. see difference synthax?
$urlrouterprovider.otherwise('/'); $stateprovider.state('camera',{ url:"/camera", cache: false, controller:"cameractrl", templateurl:'app/views/loading/index.html' })
Comments
Post a Comment