在浏览器中的输入场中进行编辑,以在localhost上运行Angular2应用程序,在其他机器上运行的所有其他浏览器中的输入段值(平板电脑/智能手机)
每个设备是否应该在其浏览器中具有自己的角度应用实例,不要互相干扰?
工作流
- 我在'npm start'上启动angular2app,以便在localhost上(IP:192.168.111.1:3000)
- i与浏览器与http://localhost:3000 连接
- 我从另一台设备(例如平板电脑,智能手机)连接到http:/192.168.111.1:3000
- 在所有设备上的所有浏览器中,输入场显示正确的显示
- 但是,在local-Host 更改在输入器中编辑更改 INPUT-FIEL的值在平板电脑/智能手机上运行的所有其他浏览器中
代码片段:
login.component.ts
import {Component} from '@angular/core';
@Component({
templateUrl: 'app/components/login/login.component.html',
selector: 'login-comp'
,providers: []
,directives: []
})
export class LoginComponent {
private userName: String;
private userPw: String;
...
login.component.html
<div>
<p>User: <input pInputText id="userName" (ngModel)="userName" /></p>
<p>Password: <input pInputText id="userPw" (ngModel)="userPw" type="password"/></p>
<p><button (click)="login()">login</button></p>
</div>
这是因为您安装了"浏览器同步"。要禁用此功能,您必须将Node_modulesbrowser-synclibdefault-config.js
设置为false。
ghostMode: {
clicks: false,
scroll: false,
location: false,
forms: {
submit: false,
inputs: false,
toggles: false
}
}