我正在使用angular-strap的模式,并建立了自己的模板。我的问题是,我的模板有两个按钮,但是,我的文本和这些按钮的功能将会改变。因此,我想在打开它之前将该数据传递给模型。
在文档中它说
// Pre-fetch an external template populated with a custom scope
var myOtherModal = $modal({scope: $scope, template: 'modal/docs/modal.tpl.demo.html'});然而,我还没能让它工作。请注意,我只希望将一些值传递到模式作用域,而不是我的整个父$scope (示例似乎就是这样做的)
发布于 2014-08-26 15:17:24
它不像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'});https://stackoverflow.com/questions/21393300
复制相似问题