AngularJs绑定值不显示
AngularJs binding value does not show
我正在尝试通过 {{}} 更新元素值。这是我的 HTML.
<section id="eee" ng-controller="DiagCtrl" <input type="hidden" id="lst" name = "lst" value="{{process_list(lst)}}">>
<h2><a href="#eee">EEE</a></h2>
<div id="paper" ></div>
<div id="tt" ng-model="toolTip" ><span >{{toolTip}}</span > </div>
</section>
鼠标悬停事件调用控制器。
paper.on('cell:mouseover',
function(cellView, evt) {
var t = cellView.model.attributes.attrs.text.text;
angular.element(document.getElementById("eee")).scope().setTooltip(t);
cellView.model.attributes.attrs.title = t;
}
);
控制器
app.controller("DiagCtrl", function ($scope, getApiDataService) {
$scope.lst = [];
$scope.toolTip = [];
$scope.setTooltip = function (table) {
$scope.toolTip = table;
}
$scope.process_list = function (list) {
add_cell(list);
}
});
即使在鼠标悬停事件之后,{{toolTip }} 也不会被设置。我在这里缺少什么?
ng-model
指令不适用于 <div>
标签。它适用于 <input>
和 <select>
标签。
要在鼠标悬停时设置某些内容,请使用 ng-mouseover
指令。
<span ng-mouseover="setToolTip('hello')">{{toolTip}}</span >
JS
$scope.setTooltip = function (table) {
$scope.toolTip = table;
};
我正在尝试通过 {{}} 更新元素值。这是我的 HTML.
<section id="eee" ng-controller="DiagCtrl" <input type="hidden" id="lst" name = "lst" value="{{process_list(lst)}}">>
<h2><a href="#eee">EEE</a></h2>
<div id="paper" ></div>
<div id="tt" ng-model="toolTip" ><span >{{toolTip}}</span > </div>
</section>
鼠标悬停事件调用控制器。
paper.on('cell:mouseover',
function(cellView, evt) {
var t = cellView.model.attributes.attrs.text.text;
angular.element(document.getElementById("eee")).scope().setTooltip(t);
cellView.model.attributes.attrs.title = t;
}
);
控制器
app.controller("DiagCtrl", function ($scope, getApiDataService) {
$scope.lst = [];
$scope.toolTip = [];
$scope.setTooltip = function (table) {
$scope.toolTip = table;
}
$scope.process_list = function (list) {
add_cell(list);
}
});
即使在鼠标悬停事件之后,{{toolTip }} 也不会被设置。我在这里缺少什么?
ng-model
指令不适用于 <div>
标签。它适用于 <input>
和 <select>
标签。
要在鼠标悬停时设置某些内容,请使用 ng-mouseover
指令。
<span ng-mouseover="setToolTip('hello')">{{toolTip}}</span >
JS
$scope.setTooltip = function (table) {
$scope.toolTip = table;
};