我正在Angular JS中创建一个自定义指令.我想在模板渲染之前格式化ng-model.
这是我到目前为止:
app.js
app.directive('editInPlace', function() {
return {
require: 'ngModel',
restrict: 'E',
scope: { ngModel: '=' },
template: '<input type="text" ng-model="ngModel" my-date-picker disabled>'
};
});
Run Code Online (Sandbox Code Playgroud)
HTML
<edit-in-place ng-model="unformattedDate"></edit-in-place>
Run Code Online (Sandbox Code Playgroud)
我想在将unformattedDate值输入模板的ngModel之前格式化.像这样的东西:
template: '<input type="text" ng-model="formatDate(ngModel)" my-date-picker disabled>'
Run Code Online (Sandbox Code Playgroud)
但这给了我一个错误.这该怎么做?
这是我的代码:
SomeFunction(m => {
ViewData["AllEmployees"].Where(c => c.LeaderID == m.UserID);
})
Run Code Online (Sandbox Code Playgroud)
并返回此错误:
并非所有代码路径都返回type的lambda表达式中的值 System.Func<IEnumerable>
不应包含管道 (|) 字符的字符串的正则表达式是什么?例如,“这是一个例子 |” 带有管道字符的字符串。