我目前正在为Umbraco 7.11处理自定义数据类型,我想在用户单击“保存并发布”之前,在保存和发布文档之前更新$scope.model.value
。 / p>
我已经在Umbraco API documentation中进行了搜索,以查找我可以订阅的任何钩子或事件,以实现此目的,但是却找不到任何东西。
下面是一个模拟的数据类型控制器,显示了我想要实现的角度:
angular.module('umbraco')
.controller('MyDataType', ['$scope', function ($scope) {
// I want to update the value of the data-type just before the
// document is published, by calling this function
function onBeforeSaveAndPublish() {
console.log('Run this code before the document is saved and published')
// Example of what I would like to do before document is saved and published
$scope.model.value = new Date().toString()
}
// Where to register onBeforeSaveAndPublish() ? Is this possible ?
}])
这是可能的,还是我应该重新考虑数据类型的设计?