Oam*_*Psy 9 data-binding angularjs angularjs-scope angularjs-ng-click
在页面加载时,我有一个调用服务的控制器,然后将返回的数据绑定到某些$ scope.objects:
app.controller("MainController", function($scope, $http, serviceGetData) {
serviceGetData.getData(function(data) {
$scope.LoginCount = data.LoginCount;
$scope.ProductInfo = data.ProductInfo;
$scope.ProfileInfo = data.ProfileInfo;
// Delayed binding
$scope.OrderHistory = { History: [] };
}
$scope.populateModel = function(model, values) {
var isArray = $.isArray(values);
$.each(values, function(key, value) {
if (isArray) {
key = this.key;
value = this.value;
}
if (model[key] !== value) {
model[key] = value;
}
});
};
}
Run Code Online (Sandbox Code Playgroud)
在我的HTML中,我尝试通过以下方式绑定$ scope.OrderHistory:
<h1><a href="#" ng-click="populateModel(OrderHistory , { History: OrderEntries })" >View order details</a></h1>
Run Code Online (Sandbox Code Playgroud)
这在笔记本电脑/台式机上观看时很好,但在平板电脑和移动设备(如iphone/ipad)中无法正常工作
| 归档时间: |
|
| 查看次数: |
15874 次 |
| 最近记录: |