angular.js - 关于Angular和RequireJS的问题怎么结合
大家讲道理
大家讲道理 2017-05-15 16:57:08
0
7
619


以上是我的项目路径,找了很多资料了,不知道怎么将Angular和RequireJS结合起来

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(7)
伊谢尔伦

I was also very keen on using Angular and RequireJS to call resources flexibly at the beginning. I used it for a while, but then I suddenly realized that it didn’t make much sense. After that, I modified the strategy so that only plug-ins are loaded using RequireJS, and other controllers, routers, etc. are packaged in files such as app.js. In fact, the file is not big. The business code is already compressed to 150K, which is incredible. Why spend so much time combining Angular and RequireJS, and it will introduce many bugs.

仅有的幸福

Use angular-async-loader to implement asynchronous loading of angular modules, including various controllers, filters, services, directives, etc., and also supports angular-ui-router

http://my.oschina.net/sub/blog/513255/

https://github.com/subchen/angular-async-loader

曾经蜡笔没有小新

angular-requirejs-seed · GitHub

过去多啦不再A梦

Try this? generator-require-angular

迷茫

Regarding using RequireJS and Angular together, I think it is better to choose based on the business scenario. It is not necessary for general applications. Our group has been using Dojo before. Dojo is based on the AMD specification and uses RequireJS for module management. I once Want to use RequireJS to manage Angular and Dojo. It is the advantage of Angular + Dojo's rich UI components. After all, Angular's UI controls are not complex enough. After all, there are still no super complex components like TreeGrid. But in the end, after playing around with it, I always felt that the Require method and Angular's own modularization did not seem to match. During the use process, it felt very strange, especially for newbies in the team, who were easily confused.

This is a simple attempt before https://github.com/hjzheng/RequireJS-Dojo-AngularJS

In the end, everyone agreed that we should give up Dojo and use Angular + Angular-UI—Bootstrap + UI-Grid. If not, we can develop new instructions ourselves, which will be more efficient than before.

Of course, if you only use it for studying, the things provided by the classmates upstairs and downstairs can already satisfy you.

某草草

The dependency injection function is duplicated. In order to strengthen the layering concept, ng introduced concepts such as config, provider, factory, service, etc. In fact, in AMD, it is all done with one define. As a friend upstairs said, AMD can only surpass ng at best and manage some third-party libraries on the same level as ng.

过去多啦不再A梦

What editor do you use to solve the problem? ?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template