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

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -