小编Lul*_*ulu的帖子

AngularJS - 在自定义指令中呈现模板之前格式化ng-model

我正在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)

但这给了我一个错误.这该怎么做?

templates model directive angularjs

11
推荐指数
1
解决办法
1万
查看次数

Lambda表达式返回错误

这是我的代码:

SomeFunction(m => { 
    ViewData["AllEmployees"].Where(c => c.LeaderID == m.UserID); 
 })
Run Code Online (Sandbox Code Playgroud)

并返回此错误:

并非所有代码路径都返回type的lambda表达式中的值 System.Func<IEnumerable>

c# lambda

3
推荐指数
1
解决办法
2853
查看次数

没有管道 (|) 字符的字符串的正则表达式是什么?

不应包含管道 (|) 字符的字符串的正则表达式是什么?例如,“这是一个例子 |” 带有管道字符的字符串。

regex

3
推荐指数
1
解决办法
4583
查看次数

标签 统计

angularjs ×1

c# ×1

directive ×1

lambda ×1

model ×1

regex ×1

templates ×1