javascript - 如何在“保存并发布”之前更新自定义 Umbraco 数据类型中的 $scope.model.value?
问题描述
我目前正在为 Umbraco 7.11 开发自定义数据类型,我想$scope.model.value
在用户单击“保存并发布”时更新文档保存和发布之前的内容。
我已经在Umbraco API 文档中搜索了我可以订阅的任何类型的钩子或事件,以实现这一点,但没有找到任何东西。
以下是角度的模拟数据类型控制器,显示了我想要实现的目标:
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 ?
}])
这可能吗,还是我应该重新考虑我的数据类型的设计?
解决方案
推荐阅读
- go - websocket 设置协议和来源
- java - 同步块未执行
- reactjs - React Material-ui“选择”组件显示bug
- logging - dovecot LMTP 代理没有记录任何内容
- database - 多次插入 mongodb - 只有第一个集合被更新
- jenkins - Jenkins Last Changes 插件和子目录中的更改
- c# - 在 ASP.NET MVC 中检查条件和显示相关消息的最佳模式
- javascript - IBM Cognos Analytics 与 D3.js 条形图高度问题
- php - C:/Apache24/conf/httpd.conf: Cannot load c:/php7/php7apache2.dll into server: 找不到指定的模块
- java - 如何生成密钥以获得 HMAC SHA512 的 TOTP 符合 RFC6238 和 RFC4086?