I am beginner with angular js and I am trying to implement modal with hyperlink, I ham referring to this plunker
http://plnkr.co/edit/M7qfegYIOqOQekoxLaj5?p=preview
I have been able to successfully open modal on hyperlink, but i am not able to display the data returned from function, it always gives error, $timeout is not a function, I am passing an additional parameter as well from ng-click.
<td ng-repeat="column in columns">
<div class="animate-switch" ng-if="column == spaceIdHeaderName">
<a href="" ng-click="open(user[column])"> {{user[column]}} </a></div>
<div class="animate-switch" ng-if="column != spaceIdHeaderName">{{user[column]}}</div>
</td>
My Modal js is as:
$scope.open = function ($timeout, $log, parameter1) {
var modalInstance = $uibModal.open({
templateUrl: 'myModalContent.html',
controller: ModalInstanceCtrl,
resolve: {
items: function ($http) {
return "loadind data...";
}
}
});
modalInstance.opened.then(function($timeout, $log) {
$scope.loadData(modalInstance,$timeout, $log);
}, function() {
$log.info('Modal dismissed at: ' + new Date());
});
$scope.loadData = function(aModalInstance, $timeout, $log) {
$timeout(function() {
aModalInstance.setItems("data loaded...");
}, 3000);
};
};
var ModalInstanceCtrl = function ($scope, $uibModalInstance, items) {
$scope.items = items;
$uibModalInstance.setItems = function(theData) {
$scope.items = theData;
};
$scope.ok = function() {
$uibModalInstance.close('close');
};
$scope.cancel = function() {
$uibModalInstance.dismiss('cancel');
};
};
});
Cant figure out why $timeout is not resolved, is it something related to parameter passing ?