0
私は最初のページの情報を使用するアプリケーションを開発しており、その情報は2ページ目の入力として使用されています。 $stateParams
を使用している情報を渡すために、2番目のページには出力が表示されませんでした。
HTMLページ1:
<ion-list>
<ion-item ng-model="carBrand" ng-repeat="name in carSelect" ng-click="selectItem(carBrand)">
{{name.name}}
</ion-item>
</ion-list>
HTMLページ2:
<ion-checkbox ng-model="cartype" ng-repeat="brandType in carBrand.types">
<div align="center"><span>{{brandType}}</span></div>
</ion-checkbox><br><br>
はコントローラ:
carService.controller('carBrand',['$scope','carRepository','$rootScope','$state','$stateParams',function($scope,carRepository,$rootScope,$state,$stateParams){
$scope.newCarList=[];
$rootScope.carSelect=carRepository.data;
$scope.selectItem=$stateParams.name;
$scope.selectItem=function(key){
$scope.newCarList.push(key);
$state.go('app.CarDetails',{value:$scope.name});
}
app.js
var carService = angular.module('CarWash',['ionic']).config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('app.Cartype',{
url:'/Cartype',
views:{
'menuContent':{
templateUrl:'templates/Cartype.html',
controller:'carBrand'
}
}
})
//carEdit.html
.state('app.carEdit',{
url:'/carEdit',
views:{
'menuContent':{
templateUrl:'templates/carEdit.html'
}
}
})
あなたのルートはどのように見えますか? – Makoto
@Makoto投稿を編集しました。これが役に立ったら – Rudhra
'$ scope.selectItem = $ stateParams.name'を設定し、次の行を関数として定義するのはなぜですか? – jusopi