加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

对于Angular2,为什么具有相同组件的两个页面(两个选项卡)会相互

发布时间:2020-12-17 07:52:25 所属栏目:安全 来源:网络整理
导读:这是一个Angular2应用程序,该组件在此简化为: @Component({ selector: 'courses',template: ` input [(ngModel)]="wahla" input [(ngModel)]="wahla" {{ wahla }} `})export class CoursesComponent { wahla = "hmm hmm ha ha";} 我认为应用程序在一个页面
这是一个Angular2应用程序,该组件在此简化为:
@Component({
    selector: 'courses',template: `
        <input [(ngModel)]="wahla">
        <input [(ngModel)]="wahla">
        {{ wahla }}
        `
})
export class CoursesComponent {
    wahla = "hmm hmm ha ha";
}

我认为应用程序在一个页面中使用双向绑定工作正常,但是如果我用http://localhost:3000/打开另一个选项卡然后在第一页的第一个输入框中粘贴或键入内容,则第二个选项卡实际上会更新为第一个输入框,而第二个输入框和静态文本不更新.

对于第一个选项卡,所有内容都按预期更新.

这应该发生还是可能出错?这是使用npm start运行的,它运行带有BrowserSync的lite-server.

这是lite-server的一个功能,而不是一个bug,或者它可能看起来像是一个.

为了使这个发生lite-server uses javascript扩展Browsersync.

在lite-server的npm页面上,就像这样提到了

lite-server is a simple customized wrapper around BrowserSync to make
it easy to serve SPAs.

和BrowserSync将它放在他们的website上

Time-saving synchronised browser testing

这清除了所有怀疑的阴云

With each web page,device and browser,testing time grows
exponentially. From live reloads to URL pushing,form replication to click mirroring,Browsersync cuts out repetitive manual tasks.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读