本文介绍了了解离子选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
林尝试使用离子性列表中显示一组汽车中,当特定的轿厢选择它应该显示它的一小描述和也可编辑的.在这里,我无法显示所选项目的描述.另外,请让我知道如何编辑说明并进行更新.
Im trying to use ionic list to display a set of cars, when the particular car is selected it should display a small description of it and also editable. Here Im unable to display the description of the item selected. Also please let me know how to edit the description and update it.
这是控制者
car.controller('popSelect', ['$scope','$ionicPopup', function ($scope, $ionicPopup) {
$scope.homePage = function () {
window.location = "#/menu.html"
}
$scope.carList = [{ value: "Honda", description: "Its honda" },
{ value: "Toyota", description: "Its Toyota" },
{ value: "BMW", description: "Its BMW" }];
//$scope.carList=['Bmw','Mercedes','Honda'];
$scope.select_item = function (key) {
{{item.decription}}
}
}]);
推荐答案
Index.html中的更改
Changes in Index.html
<body ng-app="myApp" ng-controller="myCtrl">
<h4>Select car</h4>
<ion-list>
<ion-item ng-click="select_item(value)" ng-repeat="(key,value) in carList">
{{value.value}}
</ion-item>
</ion-list><hr>
<div style="text-align:center">
<button class="button3" ng-click="showPopup()">ADD</button><hr>
<button class="button2" ng-click="homePage()">Back</button>
<button class=" button2" ng-click="deleteSelected()">Delete</button>
</div>
<div>{{description}}</div>
<!--{{couponTitle}} {{couponDescribe}} {{validFrom}} {{validTo}} -->
</body>
在您的js中
var car=angular.module('myApp',[]);
car.controller('myCtrl', ['$scope', function ($scope) {
$scope.homePage = function () {
window.location = "#/menu.html"
}
// $scope.description = '';
$scope.selectedItem = 'select';
$scope.items=[];
$scope.carList = [{ value: "Honda", description: "Its honda" },
{ value: "Toyota", description: "Its Toyota" },
{ value: "BMW", description: "Its BMW" }];
//$scope.carList=['Bmw','Mercedes','Honda'];
$scope.select_item = function (key) {
$scope.description=key.description;
}
}]);
谢谢(是)
这篇关于了解离子选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!