【发布时间】:2021-03-23 14:50:12
【问题描述】:
我希望有人可以帮助我解决这个问题,这真的让我发疯:P 我创建了一个 Plunker 来说明这个问题。在此处查看演示 http://plnkr.co/edit/BRlDgKYlE87Bh3t53tpZ?p=preview。
My code is in the plunker.
所以我的问题是我无法在我所在的另一个 html 视图中更改我的范围值。正如 Plunker 所示,我在 index.html 中有两个按钮;按钮 1 和按钮 2。当我单击 button1 时,我希望 scope.test 更改为“button1”,当我单击 button2 时,它应该更改为“button2”,该值存在于 index2.html 中。正如您在 console.log 消息中看到的那样,这永远不会发生。我使用 rootscope,但是如果范围存在于同一个 html 页面中而不是另一个页面中,我仍然只能更改值。请帮忙!
【问题讨论】:
标签: angularjs angularjs-scope steroids rootscope