Javascript 如果从jquery的onclick函数调用,则不更新
我试图填充select from ng repeat的值,但它没有更新select中的任何值,但与我从ng click函数调用的内容相同,它正在更新select,我无法找出问题所在 下面是我使用onclick时的代码:Javascript 如果从jquery的onclick函数调用,则不更新,javascript,jquery,angularjs,Javascript,Jquery,Angularjs,我试图填充select from ng repeat的值,但它没有更新select中的任何值,但与我从ng click函数调用的内容相同,它正在更新select,我无法找出问题所在 下面是我使用onclick时的代码: <label><input type="radio" ng-model="tableSource.name" id="browseDataLov" name="typeOfData" value="lov" onclick="callAct()">xyz
<label><input type="radio" ng-model="tableSource.name" id="browseDataLov" name="typeOfData" value="lov" onclick="callAct()">xyz </label>
<label><input type="radio" ng-model="tableSource.name" id="browseDataInside" name="typeOfData" value="Others" ng-click="aiWidgetOthers('table')">
Others</label>
<select id="Assign" name="Assign" class="" multiple size="7">
<option ng-repeat="item in items" data-id="{{item .id}}" data-format="{{item .format}}" value="{{item .name}}">{{item .name}}</option>
</select>
<div id="testDiv" ng-controller="dbCtrl"></div>
function callAct(){
angular.element(document.getElementById('testDiv')).scope().wid();
angular.element(document.getElementById('testDiv')).scope().$apply();
}
app.controller('dbCtrl', function($scope){
$scope.wid= function(){
$scope.items = [{
"id" : 1,
"name" : "xyz",
"format" : "xml"
},{
"id" : 2,
"name" : "abc",
"format" : "xml"
}]
});
xyz
其他
{{item.name}
函数callAct(){
元素(document.getElementById('testDiv')).scope().wid();
元素(document.getElementById('testDiv')).scope().$apply();
}
app.controller('dbCtrl',函数($scope){
$scope.wid=函数(){
$scope.items=[{
“id”:1,
“名称”:“xyz”,
“格式”:“xml”
},{
“id”:2,
“名称”:“abc”,
“格式”:“xml”
}]
});
以下是使用ng click时的代码:
<label><input type="radio" ng-model="tableSource.name" id="browseDataLov" name="typeOfData" value="lov" ng-click="wid()">xyz </label>
xyz
但是由于某些原因,我需要从onclick函数调用它,因为在我第一次来到这个页面时,ng click可以很好地工作,但是一旦我路由页面并再次返回,该函数就会停止工作,因为这个select在jquery对话框中你能发布小提琴吗?为什么你甚至想将jquery与Angular混合使用?因为恩,我正在将页面重新路由到此页面,因为它的ng click函数停止工作。只有jquery对话框下的函数所有这些函数停止工作其他函数工作正常。这就是我需要将jquery与angularjs一起使用的原因