如何使用angular 6 Route Auth Guards用于所有路由Root和Child Routes?
我们在我们的应用程序中使用Angular 6.在该应用程序中,我们希望提供多语言支持.
我们如何在角度6中实现本地化和国际化?它是一个角度6版本.
localization internationalization typescript angular angular6
我是angular的新手,并试图与easyui angular结合使用。
我在尝试打开/关闭对话框时发现此错误:
错误错误:ExpressionChangedAfterItHasBeenCheckedError:检查表达式后,表达式已更改。以前的值:'klass:l-btn f-inline-row f-content-center l-btn-small l-btn-focus'。当前值:'klass:l-btn f-inline-row f-content-center l-btn-small'。
这是我的代码。
user.component.html
<eui-linkbutton (click)="addAction()" iconCls="icon-add" style="margin-bottom:10px">Add New</eui-linkbutton>
<eui-datagrid
[data]="users" style="height1:250px" [filterable]="true"
[selectionMode]="'single'"
[(selection)]="rowSelected"
[euiContextMenu]="contextMenu"
>
</eui-datagrid>
<!-- contextmenu -->
<eui-menu #contextMenu (itemClick)="contextClick($event)">
<eui-menu-item value="edit" text="Edit"></eui-menu-item>
<eui-menu-item text="Delete"></eui-menu-item>
<eui-menu-item text="View"></eui-menu-item>
</eui-menu>
<eui-dialog #formDialog [closed]="closed" [draggable]="true" [modal]="true" [title]="isNewRow ? 'Add' : 'Edit'" (close)="closed=true">
<div class="dialog-button">
<eui-linkbutton [disabled]="!formObj.valid" (click)="saveAction()" style="width:80px">Save</eui-linkbutton>
<eui-linkbutton (click)="formDialog.close()" style="width:80px">Cancel</eui-linkbutton>
</div>
</eui-dialog>
Run Code Online (Sandbox Code Playgroud)
user.component.ts
export class UserComponent implements OnInit {
rowSelected = null;
formObj: FormGroup;
constructor(public userService: UserService, …Run Code Online (Sandbox Code Playgroud) 我用以下命令创建了新的角度项目
ng new hello-world
Run Code Online (Sandbox Code Playgroud)
它失败了
npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, flatted is its successor.
npm ERR! Unexpected end of JSON input while parsing near '...rocess":"~0.7.0"},"_h'
Run Code Online (Sandbox Code Playgroud)
然后我安装平板使用...
npm i flatted
Run Code Online (Sandbox Code Playgroud)
但错误仍然存在.如何使用flatted而不是deprecated library circular-json?
我使用 Angular Material 中的 DatePicker,我想将输出格式更改为yyyy/mm/dd.
目前它以以下格式打印日期:Wed Nov 14 2018 00:00:00 GMT+0100 (Central European Normal Time)
我怎样才能做到这一点?
datepicker = new FormControl('', [Validators.required]);
console.log(this.datepicker.value.toString());
Run Code Online (Sandbox Code Playgroud) 我有一个名为name和attendance两列的表,这是一个单选按钮,我想实现每当我点击一行时,我得到该行的名称和出勤的值.问题是每当我点击一行时,事件就会触发两次,并显示两次名称.我在下面添加了代码
<table class="col-md-12 text-center">
<tr>
<th class="text-center">Name</th>
<th class="text-center">Attendance</th>
</tr>
<tr class="" data-id='1'>
<td>Md. Khairul Basar</td>
<td class="form-inline table_attendance">
<div class="form-check form-check-radio">
<label class="form-check-label">
<input class="form-check-input" type="radio" name="exampleRadio"
id="exampleRadios1" value="option1">
<span class="form-check-sign"></span>
Present
</label>
</div>
<div class="form-check form-check-radio">
<label class="form-check-label">
<input class="form-check-input" type="radio" name="exampleRadio"
id="exampleRadios2" value="option2" checked>
<span class="form-check-sign"></span>
Absent
</label>
</div>
</td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
以下是jQuery代码.
<script>
$(document).ready(function () {
$(".table_attendance").on('click', function () {
var attendance = {
name: $(this).closest("tr").find("td:nth-child(1)").text()
}
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
我已经按照与此问题相关的其他答案添加了他们的解决方案,例如添加.off("click") …
angular ×5
typescript ×5
javascript ×4
angular6 ×2
click ×1
datepicker ×1
jquery ×1
localization ×1
node.js ×1
npm ×1
onclick ×1