Angularjs 将json数据导入ioni视图
我有这个控制器Angularjs 将json数据导入ioni视图,angularjs,json,ionic-framework,Angularjs,Json,Ionic Framework,我有这个控制器 "use strict"; var app = angular.module('ng-laravel'); app.controller('StartCtrl',function($scope, $http,$rootScope,$ionicLoading,$cordovaDevice,$cordovaVibration,ionicToast,$ionicPlatform,$cordovaNetwork){ $http.get('https://www.myurl.co
"use strict";
var app = angular.module('ng-laravel');
app.controller('StartCtrl',function($scope, $http,$rootScope,$ionicLoading,$cordovaDevice,$cordovaVibration,ionicToast,$ionicPlatform,$cordovaNetwork){
$http.get('https://www.myurl.com/stringjson').
success(function(data, status, headers, config) {
$scope.progetti = data.items;
}).
error(function(data, status, headers, config) {
// log error
});
});
正确获取json数据的方法如下:
[{"id":2,"titolo":"The Marriage","descrizione":"Sal, a thirteen year old girl, narrates a story told
by her Grandfather, which begins in a hospital room after Sal\u2019s Grandmother becomes ill during
a road trip. The story of The Marriage Bed flashes back to small-town Kentucky, where Sal\u2019s grandparents
first met. Gramps feels love at first sight for Gram, and courts her for the better part of a month
before she accepts a marriage proposal. On the night of their wedding, Gramps and Gram find a special
bed in their new home: the bed that had belonged to Gramps\u2019 parents, and the bed that they\u2019ve
slept in all of their lives since. The tale ends with Sal wondering about her own romantic future.
","inizio":"2016-12-17 00:00:00","fine":2016,"goal":10000,"banner":"1457196511-29619972.png","entry_by"
:1,"created_at":"2016-03-05 17:48:31","updated_at":"2016-03-06 11:33:02","funded":"0","pledged":1000
,"image":"","id_categoria":5,"staff_picked":null,"vetrina":null,"summary":"A young girl traveling with
her Grandparents recounts a favorite family love story ","numero_finanziatori":2,"active":1,"tags":""
,"banner3":"","image2":"","image3":"","motivazione":"Vediamo se funziona","didascalia":"Prova prova"
,"rating":5,"prima":0,"id_azienda":0,"banner2":""}
这是我的视图,无法显示数据
欢迎
我们的项目
{{items[0].nome}
{{data.nome}}
返回登录
您打印了错误的变量
<ion-list>
<ion-item ng-controller="StartCtrl" class="item-avatar">
<h2>{{ progetti[0].titolo}}</h2>
</ion-item>
</ion-list>
{{progetti[0].titolo}
试试这个。。
只有
$scope
和此
变量是自动同步的 您打印了错误的变量
<ion-list>
<ion-item ng-controller="StartCtrl" class="item-avatar">
<h2>{{ progetti[0].titolo}}</h2>
</ion-item>
</ion-list>
{{progetti[0].titolo}
试试这个。。
只有$scope
和此
变量是自动同步的 对不起,错误的变量:)它不是nome而是titolo对不起,错误的变量:)它不是nome而是titolo