小编Kun*_*nal的帖子

ngSubmit以Angular 2格式刷新页面

我正在使用Angular2模板来创建表单.

当我点击按钮时,页面刷新.

我的验证工作正常.

当用户点击按钮时,如何停止页面刷新?

以下是我正在使用的HTML: -

<div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title">Add Employee</h3>
        {{model | json}}
        {{EName.errors | json}}
    </div>
    <div class="panel-body">  
        <form (ngSubmit)="onSubmit(empForm)" #empForm="ngForm" autocomplete="off" novalidate>

        <div class="form-group">
            <label for="EmployeeName">Employee Name</label>
            <input type="text" class="form-control" id="EmployeeName" placeholder="Employee Name" required [(ngModel)]="model.EName" name="EName" #EName="ngModel" ngControl="Ename" #EName="EName" >
            <div *ngIf="EName.touched && EName.errors" >
                <div *ngIf="EName.errors.required"  class="alert alert-danger">
                    Employee Name is required
                </div>
            </div>
        </div>
        <div class="form-group">
            <label for="Age">Age</label>
            <input type="text" class="form-control" id="Age" name="Age" placeholder="Age" [(ngModel)]="model.Age" ngControl="Age">
        </div>
        <div class="form-group">            
            <label for="Sex">Sex</label>
            <div …
Run Code Online (Sandbox Code Playgroud)

typescript angular

60
推荐指数
5
解决办法
4万
查看次数

反应路由器链接参数.意外的字符'''.在uglify和eslint中

当使用gulp uglify和eslint时,我会得到意想不到的字符'''.

<td><Link to={`/user/${u.userId}`}>{u.UserName}</Link></td>
Run Code Online (Sandbox Code Playgroud)

在gulp文件中

Gulp.task('js', function(){
    Browserify(GulpConfig.paths.mainJs, { debug: (production() ? false : true)})
        .transform(Reactify)
        .bundle()
        .on('error', console.error.bind(console))
        .pipe(Source('bundle.js'))
        .pipe(production(Buffer()))
        .pipe(production(Uglify().on('error', gulpUtil.log)))
        .pipe(Gulp.dest(GulpConfig.paths.dist + '/scripts'))
        .pipe(Connect.reload());
});
Run Code Online (Sandbox Code Playgroud)

怎么处理?

reactjs eslint gulp-uglify react-router

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