Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.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
AngularJS ng更改不适用于AngularJS$compile_Angularjs_Macos_Google Chrome Extension_Angularjs Ng Change - Fatal编程技术网

AngularJS ng更改不适用于AngularJS$compile

AngularJS ng更改不适用于AngularJS$compile,angularjs,macos,google-chrome-extension,angularjs-ng-change,Angularjs,Macos,Google Chrome Extension,Angularjs Ng Change,错误:$compile:ctreq 缺少所需的控制器 找不到指令“ngChange”所需的控制器“ngModel” 示例代码 //create dynamic UI var targetQDom = '<div id="' + item.id + '" style="width=100%;background: white;" ><div class="head" style="border-bottom-color: azure;border-bottom-s

错误:$compile:ctreq
缺少所需的控制器
找不到指令“ngChange”所需的控制器“ngModel”

示例代码

    //create dynamic UI

var targetQDom = '<div  id="' + item.id + '" style="width=100%;background: white;"  ><div class="head" style="border-bottom-color: azure;border-bottom-style: double;"><a style="color:aliceblue"><i class="fa fa-times-circle-o fa-fw fa-2x bt-right" style="margin-top: -4px;" ng-change="removeR(' + item.id + ',' + (index + 1) + ',$event)"></i></a> <a style="color:white;" data-toggle="collapse" class="collapsed" data-target="#' + item.id + '-rule-' + (index + 1) + '" ng-change="targetqClick(' + item.od + ',' + (index + 1) + ',' + item.req + ')" >' + item.text + '</a></div></div>';
var $targetQDom = window.j$(targetQDom).appendTo('#appendRules');
$compile($targetQDom)($scope);
//创建动态用户界面
var targetQDom=''+item.text+'';
var$targetQDom=window.j$(targetQDom).appendTo(“#appendRules”);
$compile($targetQDom)($scope);
上述代码将出现在控制器中。 上面的代码基于模型数据动态创建HTML。 在运行应用程序后,我在控制台中遇到上述错误,并且它没有创建UI

如果我使用ng,请单击上面的代码

MAC操作系统Google chrome的其他问题

但ng click在MAC操作系统中发布了谷歌chrome下拉列表更改,该更改不起作用。
. 如果我尝试更改下拉列表值,它不会被触发。因此目标下拉列表值不会更改。

我尝试复制它,但在代码中发现了一些错误。看看这个

 <!DOCTYPE html>
 <html>
 <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"> 
 </script>
 <body ng-app="myApp">
 <div ng-controller="myCtrl">

 <div id="someid" style="float: left;">
  <select id="some-condition-list" class="some-control cursor_Hand" 
  ng-model="selectedsome"  ng-change="somechange(someindex,$event)" >
  <option value="">Show All</option>
 <option ng-repeat="some in somes.condtions " value="{{some.Id}}">{{some.name}} 
</option>
</select>

全部展示
{{some.name}


angular.module('myApp',[])
.controller('myCtrl',['$scope',函数($scope){
$scope.count=0;
$scope.some=“嘿”;
$scope.somes={};
$scope.somes.conditions=[];
$scope.somes.conditions=[{'Id':'1','name':“Gayani”},{'Id':'2',
'name':“Chaminda”}];
$scope.selectedsome=“HI”;
$scope.someindex=1;
$scope.somechange=函数(项,项1){
警报(项目);
}
}]);

ng model
添加到元素中,例如
HTML控件具有该模型。但我在这里创建动态HTML。是的,它有ng-model。这是示例代码“Show All{{some.name}Post some代码”。没有它,就很难帮助您。ng model=“selectedsome'+$scope.some+'”ng change=“somechange”(“+$scope.someindex+”,$event)”无效,如果要访问html中的范围数据,必须删除$scope。它应该是
ng model=“selectedsome'+some+”“ng change=“somechange(“+someindex+”,$event)”
,但正如cst所说,发布一些代码,以便我们可以进一步提供帮助
</div>

<script>
   angular.module('myApp', [])
     .controller('myCtrl', ['$scope', function($scope) {
  $scope.count = 0;
  $scope.some="Hey";
  $scope.somes ={};
  $scope.somes.condtions =[];
  $scope.somes.condtions =[{'Id':'1', 'name':"Gayani"},{'Id':'2', 
    'name':"Chaminda"}]; 
  $scope.selectedsome="HI";
  $scope.someindex=1;
  $scope.somechange = function(item, item1){
  alert(item);
  }
}]);
</script>
</body>