0
我打电话给ng-click这个函数。Angularjs:空物体,只有一次点击时?
HTML
<div class="col-md-offset-10">
<div class="form-group">
<a class="btn btn-default" ng-click="schedule()">Add</a>
</div>
</div>
JS
$scope.scheduleid={};
var inc=0;
$scope.schedule = function()
{
inc += 1;
console.log($scope.from);
console.log ($scope.dateObj);
if (inc == 1)
{
var schedule = {}
schedule._type = "Schedule";
console.log($scope.dateObj);
var insertSchedule = BasicJSONCreator.basicEdit();
insertSchedule.Calls[0].Arguments = [];
insertSchedule.Calls[0].Arguments[0] = schedule;
httpRequester.async (insertSchedule).then (function (data) {
console.log(data.data.ReturnValues[0].scheduleID);
$scope.scheduleid=data.data.ReturnValues[0] //This get response from my database
console.log($scope.scheduleid); // here object is get my data from database
});
}
$scope.getData();
}
这个函式我希望得到$scope.scheduleid
造成的,但这里的问题。 当我有一个点击$scope.scheduleid
(空),但两个和更多点击$scope.scheduleid
(没有空和获取数据)。为什么我第一次点击是空的。
$scope.getData=function()
{
console.log($scope.scheduleid)
// Here my object is empty when have one click,but two and more click object no empty and get data
}
我想那可能就是这么说的! –
希望它帮助你解决问题:) –
完美这个$超时是超级:) –