如何将自定义数据传递给角带模式

Nic*_*ise 6 angular-strap

我正在使用angular-strap的模态,并建立了自己的模板.我的问题是我的模板有2个按钮,但是,我会更改这些按钮的文本和功能.因此,我想在打开它之前将该数据传递给模态.

在文档中说

// Pre-fetch an external template populated with a custom scope
  var myOtherModal = $modal({scope: $scope, template: 'modal/docs/modal.tpl.demo.html'});
Run Code Online (Sandbox Code Playgroud)

但是,我无法让它工作.请注意,我只想将一些值传递给模态范围,而不是我的整个父范围(这是示例似乎做的)

luc*_*ssp 6

它不像ui-bootstrap那么简单,但它看起来更灵活:

// creates new isolated scope
var myNewScope = $scope.$new(true);
// then you can data to your new scope
myNewScope.users = ["User1", "User2", "User3"];
var myOtherModal = $modal({scope: myNewScope, template: 'modal/docs/modal.tpl.demo.html'});
Run Code Online (Sandbox Code Playgroud)