javascript - Ionic: Exactly the same code, different output? -
hi stackoverflow members,
i've set codepen here: link works perfectly. however, when try implement ionic application cannot receive json data though code same , cannot understand why it's not working.
<body ng-controller="controller"> <ion-view view-title="announcements"> <ion-content class="padding"> <ion-refresher pulling-text="pull refresh..." on-refresh="dorefresh()"> </ion-refresher> <ion-list> <ion-item ng-repeat="data in data"> <div class="list card"> <div class="item item-divider">{{data.announcement_name}} - {{data.date}}</div> <div class="item item-body"> <div> {{data.message}} </div> </div> </div> </ion-item> </ion-list> </ion-content> </ion-view> </body>
and here's controller:
angular.module('ionicapp', ['ionic']) .controller('controller', ['$http', '$scope', function ($http, $scope) { $scope.data = []; $scope.dorefresh = function () { $http.get('https://api.myjson.com/bins/3z1eg') .success(function (data) { $scope.data = data; }) .finally(function () { $scope.$broadcast('scroll.refreshcomplete'); }); }; }]);
i don't errors in console log when run code (which annoying) have no idea problem is. brilliant. thanks.
you may need white-list address you're trying access. this plugin allows white-list addresses. catch-all solution can add following config.xml:
<allow-intent href="*" />
note however, not recommended. see documentation how allow more specific urls / protocols.
Comments
Post a Comment