我已经在Kendo UI网格中绑定了批量记录.响应从Json返回.
使用以下格式时出现错误:
问题代码:方法1:
public JsonResult KendoserverSideDemo(int pageSize, int skip=10)
{
using (var s = new KendoEntities())
{
var total = s.Students.Count();
if (total != null)
{
var data = s.Students.OrderBy(x=>x.StudentID).Skip(skip)
.Take(pageSize).ToList();
return Json(new { total = total,
data = data,
JsonRequestBehavior.AllowGet });
}
else
{
return null;
}
}
}
Run Code Online (Sandbox Code Playgroud)
方法2:使用此工作正常:
public JsonResult KendoserverSideDemo(int pageSize, int skip=10)
{
using (var s = new KendoEntities())
{
var total = s.Students.Count();
if (total != null)
{
var data = s.Students.OrderBy(x=>x.StudentID).Skip(skip)
.Take(pageSize).ToList(); …Run Code Online (Sandbox Code Playgroud) 在Web应用程序中,Html5中本地存储的安全性如何,或者是否有其他方法可以保护本地存储中的敏感数据.
项目结构:
前端:Html5,Angular js,Middletier: Asp.net webApi,BackEnd:Sql Server.
用户登录页面后,使用一些加密算法对该凭证进行加密.它将存储在db中.
之后,每个子动作如产品列表,订单详情,图书历史记录,添加产品需要验证.
在页面后刷新时,数据会丢失,因此需要保留数据,因此我选择了localstorage.存储使用某些js算法加密的用户名和密码,并放入本地存储器中.
我觉得它不安全,因为任何人都可以从浏览器工具中窃取数据.
在这种情况下是否有任何替代方法,否则这种方法是安全的.
任何人都可以帮助我处理.
javascript security javascript-events angularjs asp.net-web-api2
我有一个物质输入控件,我在用户输入时限制了特殊字符,但是在任何编辑器中键入一些单词并复制并粘贴具有特殊字符的单词时,这是不起作用的.
我已经编写了指令来防止特殊字符,但可以在复制粘贴中提供更好的解决方案限制.
app.component.html:
<form class="example-form">
<mat-form-field class="example-full-width">
<input matInput specialIsAlphaNumeric placeholder="Favorite food" value="Sushi">
</mat-form-field>
<mat-form-field class="example-full-width">
<textarea matInput placeholder="Leave a comment"></textarea>
</mat-form-field>
</form>
Run Code Online (Sandbox Code Playgroud)
指示:
import { Directive, HostListener, Input } from '@angular/core';
@Directive({
selector: '[specialIsAlphaNumeric]'
})
export class SpecialCharacterDirective {
regexStr = '^[a-zA-Z0-9_]*$';
@Input() isAlphaNumeric: boolean;
@HostListener('keypress', ['$event']) onKeyPress(event) {
return new RegExp(this.regexStr).test(event.key);
}
}
Run Code Online (Sandbox Code Playgroud)
https://stackblitz.com/edit/angular-cijbqy-biwrck?file=app%2Finput-overview-e[stackblit![] [1]](https://i.stack.imgur.com/suStK.png)
重现步骤:
输入不允许的特殊字符:工作正常.而复制粘贴机智允许特殊字符
angular-directive angular2-directives angular angular5 angular6
我正在使用角度材料6,我在mat-form-field mat-error中显示错误,当在mat-form-field之后移动到正确显示的mat-error时.
不工作代码:
<mat-form-field>
<input matInput type="time" formControlName="ToTime"/> <mat-error *ngIf="DaterForm.get('ToTime').hasError('InValidToTime')">FromTime Should be less than ToTime if choose a same date</mat-error>
</mat-form-field>
Run Code Online (Sandbox Code Playgroud)
工作正常:
<input matInput type="time" formControlName="ToTime"/> </mat-form-field>
<mat-error *ngIf="DaterForm.get('ToTime').hasError('InValidToTime')">FromTime Should be less than ToTime if choose a same date</mat-error>
Run Code Online (Sandbox Code Playgroud)
有人解释了为什么不在该控制范围内工作.
现场演示: stackblitz
我有组件内部
export class AppComponent implements OnInit {
public errorMsg :number =10 ;
public doughnutChartOptions: any = {
cutoutPercentage: 85,
elements: {
center: {
text: this.errorMsg + ' Energy produced in the Energy',
fontColor: '#fff',
fontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
fontSize: 24,
fontStyle: 'normal'
}
}
};
Run Code Online (Sandbox Code Playgroud)
}
text: this.errorMsg + ' some thing',
Run Code Online (Sandbox Code Playgroud)
这是一个属性接受的字符串,所以在这里我必须将数字传递给字符串,如何在angular4,typescript 2.5中执行此操作
今天在将邮件从outlook发送到Gmail时遇到了一个新问题.问题是Hyperlink元素显示为下划线.我试过下面的.
方法1:
<td width="500px" align="center" style=" text-align: left; font-size:1.2em; font-family:Candara; color: #FFFFFF;">
<a href="mailto:info@example.com" style="color:#fff;text-decoration:none;" target="_blank">info@xxx.com</a>
</td>
Run Code Online (Sandbox Code Playgroud)
方法2:
<a href="mailto:info@example.com" style="color:#fff;text-decoration:none !important;" target="_blank">info@ccc.com</a>
Run Code Online (Sandbox Code Playgroud)
方法3:
a {text-decoration: none !important; color: #000; cursor: text;}
Run Code Online (Sandbox Code Playgroud)
此代码在浏览器,Outlook中运行正常,问题出在Gmail邮箱中.因为Gmail动态地在超链接标记后附加span标记.
我在这里附上了一个视频参考:
http://recordit.co/OGlkkBiXGX
鉴于:文本装饰没有它不被gmail框占用,因为在span标签内添加标签之后.
完整代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>mailtest</title>
</head>
<body style="margin:0; padding:0;">
<table width="582" border="0" cellspacing="0" cellpadding="0" align="center" style="background:black;">
<tr>
<td width="500px" align="center" style=" text-align: left; font-size:1.2em; font-family:Candara; color: #FFFFFF;">
<img style="margin-left:10px;" src="http://codestrz.com/Content/mail/envelope.png" alt="" …Run Code Online (Sandbox Code Playgroud) 为什么kendo在使用Kendo网格的角度路由模板中加载Jquery之前.
我已经订购了脚本,同时通过角度路由模板单击任何事件,在控制台中获取此错误.
注意:在页面刷新中,脚本正确加载,应用程序正常工作,没有出现任何错误.
仅发生在事件路由中.kendo在jquery之前加载为什么.
order scripts :
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
<script src="https://code.angularjs.org/1.3.8/angular.js"></script>
<script src="//kendo.cdn.telerik.com/2016.2.714/js/kendo.all.min.js"></script>
<script src="https://code.angularjs.org/1.3.8/angular-sanitize.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.3.1/angular-ui-router.js"></script>
Run Code Online (Sandbox Code Playgroud)
我需要将 datetimeoffset 格式转换为以下格式。
在 TimeOffset 而不是 Dot 中,我需要在时间偏移之前加一个冒号。
DateTimeOffset PassDate = DateTimeOffset.Now;
var x = PassDate.ToString("o");
Console.WriteLine(PassDate.ToString("o"));
Run Code Online (Sandbox Code Playgroud)
在下面的截图中,我得到了点 - 在偏移之前。而不是点需要冒号。
当前 O/p: 2018-03-20T00:00:00.00-05:00
预期 O/p:2018-03-20T00:00:00:00-5:00
格式:
2018-03-20T00:00:00.00-05:00 to 2018-03-20T00:00:00:00-5:00
Run Code Online (Sandbox Code Playgroud) 在此演示中,我为自定义验证器创建了一个示例表单,这里有“起始日期”和“截止日期”以及“起始时间”和“截止时间”,工作正常:对于“起始日期”和“截止日期”验证工作正常并显示错误消息。
问题:当选择相同的日期时,例如)2018 年 7 月 21 日作为起始日期,并且“To date e”和“In from Time”为 4:00 AM,“To Time”为 3:00AM,条件得到满足,但没有显示错误消息。在实施过程中出现了一些问题,任何人都可以帮我解决吗?
在 html 中,我给出了验证消息,但没有显示。
To Time:
<input type="time" formControlName="ToTime">
<mat-error *ngIf="DaterForm.get('ToTime').hasError('InValidToTime')">FromTime Should be less than ToTime if choose a same date</mat-error>
Run Code Online (Sandbox Code Playgroud)
在组件中:
DaterForm : FormGroup;
constructor(private fb:FormBuilder){
}
ngOnInit(){
this.DaterForm = this.fb.group(
{
FromDate:['',[AppCustomDirective.fromDateValidator]], // validation working fine
FromTime:[''],
ToDate:['',[AppCustomDirective.ToDateValidator]],// validation working fine
ToTime:['']
},{validator:[AppCustomDirective.timeValidator] // validation not working
}
Run Code Online (Sandbox Code Playgroud)
自定义验证:
import { AbstractControl, FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms';
export class AppCustomDirective …Run Code Online (Sandbox Code Playgroud) angular2-forms angular angular-reactive-forms angular4-forms angular6
我有一个角度路由,在其中一个组件中我有简单的登录表单,并在模板中提供formGroup,它显示上面的错误.
步骤:在app模块中导入ReactiveFormsModule.
在路由组件中:
app.routingmodule.ts
import { RouterModule } from '@angular/router';
import { NgModule } from '@angular/core';
import { LoginViewComponent } from './views/login/login.component';
import { HomeViewComponent } from './views/home/home.component';
import { CatalogViewComponent } from './views/catalog/catalog.component';
@NgModule({
declarations: [
LoginViewComponent, HomeViewComponent, CatalogViewComponent
],
imports: [
RouterModule.forRoot([
{ path: 'login', component: LoginViewComponent },
{ path: 'home', component: HomeViewComponent },
{ path: 'catalog', component: CatalogViewComponent },
{ path: '**', redirectTo: 'login' }
])
],
exports: [
RouterModule
],
providers: [],
})
export class AppRoutingModule …Run Code Online (Sandbox Code Playgroud) angular2-forms angular angular-reactive-forms angular4-forms
我没有登录页面,这是 sso 调用
在应用程序组件中,我已经调度了一个操作来加载服务器端令牌调用并获取令牌,并且根据用户角色,我可以激活路由中的防护。如果守卫激活返回 true,我将进入仪表板页面。
在仪表板页面中,我在浏览器 URL 中有一个刷新,可以激活在登录操作效果之前执行,因此可以激活返回 false 且页面显示空白。
在仪表板中有子路由,也有一些子链接,例如产品仪表板/产品,也有激活的防护,但可以在登录调度操作影响成功调用之前激活返回 false。
谁能帮助我我做错了什么?
这里是路由,
{
path: '',
component: HomeComponent,
canActivate:[AuthGuard],
children: [
{
path: 'product',
loadChildren: () => productModule
},
{
path: 'order',
loadChildren: () => orderModule
}
]
},
Run Code Online (Sandbox Code Playgroud)
这是激活方法:这里我从效果调用中获得成功,同时从 app.component 调度一个操作:
canActivate(): Observable<boolean> {
return this.store.select(appState => appState.auth.isAuthenticated)
.pipe(map(authUser => {
if (!authUser) {
return authUser;
}
return authUser;
}))
}
Run Code Online (Sandbox Code Playgroud)
应用程序组件:
ngOnInit(){
this.onSubmit();
}
onSubmit(): void {
const payload = {
email: 'test@test.com',
password: 'admin'
};
alert('dispatch …Run Code Online (Sandbox Code Playgroud) ngrx-effects angular ngrx-store-4.0 angular-guards angular-ngrx-data
angular ×6
angular6 ×3
angularjs ×2
angular5 ×1
asp.net-mvc ×1
c# ×1
c#-2.0 ×1
c#-3.0 ×1
c#-4.0 ×1
css ×1
email ×1
html ×1
html5 ×1
javascript ×1
kendo-grid ×1
kendo-ui ×1
ngrx-effects ×1
outlook ×1
razor ×1
security ×1
typescript ×1