小编Jan*_*nic的帖子

在 VS Code 中关闭 HTML 标签时,需要再次手动缩进

在 Microsoft VS Code 中,当我关闭 HTML 标记(例如在底部图像上)时,当前位置将移动到第一列并删除制表符缩进。然后我需要再次使用制表符手动缩进。我该如何解决?

GIF 示例 - 请单击此处...

我的 settings.json 文件:

...
“editor.detectIndentation”:假,
"editor.wrappingIndent": "无",
“editor.trimAutoWhitespace”:假,
“files.trimTrailingWhitespace”:假,
“files.insertFinalNewline”:真,
“html.format.endWithNewline”:假,
...

html tags newline indentation visual-studio-code

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

函数ngOnChanges()在Angular 5中不起作用

ngOnChanges()每当this.test组件生命周期或模板中的变量发生更改但我无法正常工作时,我都试图在Angular 5.x组件中调用函数,但该ngOnChanges()函数始终未调用。有人可以帮我吗?

src / app.ts:

import {Component, NgModule, Input, OnChanges, SimpleChanges} from '@angular/core'
import {BrowserModule} from '@angular/platform-browser'

@Component({
  selector: 'my-app',
  template: `
    <div>
      <input type="text" placeholder="Test field" value="{{ test }}">
    </div>
  `,
})
export class App implements OnChanges {
  @Input() test: string;
  name: string;
  constructor() {
  }

  ngOnChanges(changes: SimpleChanges) {
    console.log('ngOnChanges');

    if (changes.test && !changes.test.isFirstChange()) {
      // exteranl API call or more preprocessing...
    }

    for (let propName in changes) {
      let change = changes[propName];
      console.dir(change); …
Run Code Online (Sandbox Code Playgroud)

javascript typescript ngonchanges angular

2
推荐指数
2
解决办法
6430
查看次数