angularjs - Data Binding is not working with Ionic Cards -


alright, have html page contains ionic card when bind data items not shown @ browser problem

<ion-view title="game" ng-controller="gamectrl vm">     <ion-content class="has-header">         <div class="card">             <div class="item">                 home team             </div>             <div class="item">               {{vm.game.team1}}             </div>             <div class="item">                 score: {{vm.game.team1score}}             </div>         </div>         <div class="card">         </div>         <div class="card">         </div>     </ion-content> </ion-view> 

and here angular controller page :

(function () {     'use strict';      angular.module('eliteapp').controller('gamectrl', ['$stateparams','eliteapi', gamectrl]);      function gamectrl($stateparams, eliteapi) {         var vm = this;          var gameid = number($stateparams.id);         var data = eliteapi.getleaguedata();         vm.game = _.find(data.games,{"id": gameid});      }; })(); 

i injected js file index.html; while tracing debugging function getting data data not viewed @ browser can have ?

try this:

'use strict';  angular.module('eliteapp').controller('gamectrl', ['$stateparams','eliteapi', function($stateparams, eliteapi){  var gameid = number($stateparams.id);     var data = eliteapi.getleaguedata();     this.game = _.find(data.games,{"id": gameid}); }]); 

edit

looks you're missing route game id. add .config function:

 .state('app.game-detail', {     url: "/game/:id",     views: {       "maincontent":{         templateurl: "app/game/game.html"       }     }   }) 

and change team-detail.html this:

  <a class="item item-icon-right" ng-repeat="game in vm.games"            href="#/app/game/{{game.gameid}}"> 

it should work now.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -