Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为了避免在用其他框架替换angular时重写所有代码,我想知道是否有任何解耦angularJS和JS的解决方案?如果是,如何测试它们(因为不能再使用角度测试模块)?
使用服务 通过将代码包含在服务中,您可以轻松地移动它们并调整它们以适应其他框架
拥有本地函数 通常,您创建与范围内的视图交互的函数。但是,您可以将它们放在由作用域函数调用的本地函数中。这样,当您更改框架时,您可以移动保留本地功能。
这是我想到的两件事,但我相信还有更多。