【发布时间】:2016-05-29 16:30:07
【问题描述】:
我正在使用 angular-trix。 我启动了一个模式(引导程序),但绑定不起作用。
如果我将绑定放在一个 div 中,我可以看到它被传递到模态但是对于 angular-trix 组件它没有出现。
我的代码是:
$scope.editCommentDialog = function (comment) {
var modalInstance = $modal.open({
templateUrl: 'editCommentDialog.html',
windowClass : 'edit-comment-modal-dialog',
controller: function ($scope, $modalInstance, editedComment) {
$scope.editedComment = editedComment;
$scope.ok = function () {
$modalInstance.close(editedComment);
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
},
resolve: {
editedComment: function () {
return { id : comment.id, text : comment.text};
}
}
});
modalInstance.result.then(function (editedComment) {
$scope.editedComment = editedComment;
$scope.updateComment();
}, function () {
$log.info('Modal dismissed at: ' + new Date());
});
};
和
<script type="text/ng-template" id="editCommentDialog.html">
<div class="modal-header">
<h3>Edit</h3>
</div>
<div class="modal-body">
<trix-editor angular-trix ng-model="editedComment.text" class="trix-content editable-trix-editor"></trix-editor>
</div>
<div class="modal-footer">
<button class="btn btn-primary" ng-click="ok()">OK</button>
<button class="btn btn-warning" ng-click="cancel()">Cancel</button>
</div>
</script>
【问题讨论】:
-
如果从
.then回调中删除$scope.editedComment = editedComment;会发生什么? -
我删除了它,仍然没有绑定。
-
有人有运气吗?
标签: angularjs twitter-bootstrap