Using jQuery in combination with AngularJS?

青春壹個敷衍的年華 提交于 2019-12-23 09:25:23

问题


I'm working to develop a single page framework for my company. We build lots of sites and we build them quickly so we still rely heavily on multi-page, server side templates. This means front-end developers pretty much only have to deal with CSS and jQuery for some basic DOM manipulation. It's a great system for what we currently do, but moving into the future of JS based single page sites, it requires lots time for new project resources (especially front-end developers) to get up to speed.

Currently, all of our single-page applications rely on jQuery and jQote2 for simple page transitions (like the entire container is simply replaced). Again, this works great since many of our sites are simple and straight forward, but it becomes a mess when we need to do anything custom and it can sometimes take developers hours to figure out how to make a simple change.

I've been looking into using Angular simply to manage "pages" and handle displaying the correct template based on a server call. Once Angular has displayed the page the correct template and page, I want the front-end dev's to be able to use jQuery to manipulate the current page similar to how one would manipulate a multi-page site.

For me the big bonus with Angular (compared to jQuery or jQM) is the in element directives. It's just so clear and easy for a developer to fire the site up, take a quick look at the DOM and understand how it's being modified.

Essentially, I want Angular to serve as the controller (and model when necessary), then plop a view down for jQuery to interact with. Is it possible to use Angular with jQuery in such a manner?

Is Angular total overkill for such a simple task? (I know I can write something custom, but Angular just seems to kick butt and has the ability to easily expand to our larger sites)


回答1:


It is not an overkill to use angularjs, as it is a great framework for the possibility of expanding the project. MVC structure also makes it powerful. For angularjs and jquery relation, see this, this, this



来源:https://stackoverflow.com/questions/17692340/using-jquery-in-combination-with-angularjs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!