angularjs - use a bootstrap modal without making a seperate controller -
i using bootstrap modal
controller.js -
$scope.open = function() { var modalinstance = $modal.open({ animation: true, templateurl: 'views/template.html', controller: 'controller2', resolve: { items: function() { return $scope.values; } } }); modalinstance.result.then(function(values) { $scope.new_value = values; }, function() { }); };
i don't want create new controller since modal should show values changing in current controller. should pass in place of controller2 if modal in same controller?
you use scope option instead of controller:
$scope.open = function() { var modalinstance = $modal.open({ animation: true, templateurl: 'views/template.html', scope: $scope, resolve: { items: function() { return $scope.values; } } }); modalinstance.result.then(function(values) { $scope.new_value = values; }, function() { }); };
Comments
Post a Comment