2
我不能在子控制器内部使用父控制器modalInstance
,我们如何在modalInstance
子控制器中使用变量或方法。这是我的下面的代码,迄今为止我尝试过。如何在角度js中使用父控制器函数或模型实例中的方法
ordercontroller.js
page_controller.controller('open_orderController', [
'$scope', '$rootScope', '$routeParams', '$http', '$global', '$location', '$filter', '$modal', '$bootbox',
'DTOptionsBuilder', 'DTColumnBuilder', '$q', '$compile',
function($scope, $rootScope, $routeParams, $http, $global, $location, $filter, $modal, $bootbox,DTOptionsBuilder,
DTColumnBuilder, $q, $compile) {
$scope.timeFormData = {};
$scope.my_parent_function = function()
{
$scope.timeFormData.text = "hello wordd";
}
$scope.child_controller = function()
{
var modalInstance = $modal.open({
templateUrl: 'time_change.html',
controller: function($scope, $modalInstance) {
$scope.change_timeFormData = {};
$scope.ok = function() {
$modalInstance.close();
};
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
};
},
size: 'mg',
resolve: {
}
});
}
}]);
这是工作你的代码,thanx manish帮我 –
欢迎! Praveen Kumar –
工程就像一个魅力! –