Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ionic framework 单击按钮激活,即使单击下拉/选择_Ionic Framework - Fatal编程技术网

Ionic framework 单击按钮激活,即使单击下拉/选择

Ionic framework 单击按钮激活,即使单击下拉/选择,ionic-framework,Ionic Framework,离子型: 我有这样一个列表项: <label class="item item-select item-button-left"> <button class="button button-positive" ng-click="something()" > <i class="icon ion-android-add-circle" ></i> </button> &

离子型:

我有这样一个列表项:

    <label class="item  item-select item-button-left">
      <button class="button button-positive" ng-click="something()" >
        <i class="icon ion-android-add-circle" ></i>
      </button>

        <label>My Label</label>
      <select>
        <option ng-repeat="x in xs" value="{{ x.id }}">{{ x.name }}</option>
      </select>


    </label>

我的标签
{{x.name}
每当我单击按钮时,都会调用something(),但当我单击任何东西(标签或下拉列表)时,都会调用something()。和下拉菜单不起作用


此外,html结构可能不正确。我的要求是,如果下拉列表中没有必填项,则“添加”一个新项。我知道我们可以添加“addnewone”作为select的第一个元素,当我们单击它时,它将允许我添加(使用ng change函数)。但我觉得有一个+图标要好得多。你说呢?

这个例子怎么样

(请注意,按钮必须位于
元素的外部)

angular.module('ionicApp',['ionic']))
.controller('MyCtrl',函数($scope){
$scope.addItem=函数(){
var i=$scope.xs.length;
$scope.xs.push({id:i,name:“item”+i});
};
$scope.xs=[];
对于(var i=0;i
我的标签
{{x.name}

xs.length={{xs.length | json}
谢谢你的回答+1。