Я использую веб-сервис Rest JSON в приложении Ionic. Я использую вкладки и страницу Master-Detail. На главной странице я просматриваю список элементов. Когда я пытаюсь показать страницу сведений о конкретном элементе, данные не отображаются. Любая помощь пожалуйста.Ионная: подробная страница не отображает данные в шаблоне Master-Detail с шаблоном вкладок и Json
Вот мой код:
service.js
angular.module('starter.services', [])
.factory('Njoftimet', function($http) {
return{
all: function(){
return $http.get('url')
},
get: function (njoftimId) {
return $http.get('url'+ njoftimId)
}
};
});
controllers.js
angular.module('starter.controllers', [])
.controller('DashCtrl', function($scope) {})
.controller('NjoftimetCtrl', function($scope, Njoftimet){
Njoftimet.all().success(function (response) {
$scope.njoftimet = response;
})
$scope.doRefresh = function(){
Njoftimet.all().success(function (response) {
$scope.njoftimet = response;
})
$scope.$broadcast('scroll.refreshComplete');
};
})
.controller('NjoftimDetailCtrl', function($scope, $stateParams, Njoftimet) {
$scope.njoftim = Njoftimet.get($stateParams.njoftimId);
});
app.js
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('tab', {
url: '/tab',
abstract: true,
templateUrl: 'templates/tabs.html'
})
.state('tab.dash', {
url: '/dash',
views: {
'tab-dash': {
templateUrl: 'templates/tab-dash.html',
controller: 'DashCtrl'
}
}
})
.state('tab.njoftimet', {
url: '/njoftimet',
views: {
'tab-njoftimet': {
templateUrl: 'templates/tab-njoftimet.html',
controller: 'NjoftimetCtrl'
}
}
})
.state('tab.njoftim-detail', {
url: '/njoftimet/:njoftimId',
views: {
'tab-njoftimet': {
templateUrl: 'templates/njoftim-detail.html',
controller: 'NjoftimDetailCtrl'
}
}
})
$urlRouterProvider.otherwise('/tab/dash');
})
.config(function($ionicConfigProvider) {
$ionicConfigProvider.tabs.position('bottom');
})
закладками njoftimet.html (Master)
<ion-view>
<ion-nav-bar class="bar-assertive">
</ion-nav-bar>
<ion-content>
<ion-refresher on-refresh="doRefresh()"></ion-refresher>
<ion-list>
<ion-item class="item item-icon-right" ng-repeat="njoftim in njoftimet" type="item-text-wrap" href="#/tab/njoftimet/{{njoftim.id}}">
<h2>{{njoftim.title}}</h2>
<p>{{njoftim.content}}</p>
<i class="icon ion-chevron-right icon-accessory"></i>
</ion-item>
</ion-list>
</ion-content>
</ion-view>
njoftim-detail.html (Detail)
<ion-view>
<ion-nav-bar class="bar-assertive">
<ion-nav-back-button>
</ion-nav-back-button>
</ion-nav-bar>
<ion-content class="padding">
<h2>{{njoftim.title}}</h2>
<p>{{njoftim.content}}</p>
</ion-content>
</ion-view>