我计划在AngularJS中开发我公司的客户关系管理系统。该系统不小,有客户CRUD、购物车、售后服务等模块.
正如我注意到的,通常AngularJS只有一个主要的"ng-app“。
编辑1:我不打算在每个HTML中使用一个以上的ng-app,但是在整个应用程序中有很多(大约7)。
编辑2:这个想法是为每个CRM模块创建一个角模块,例如:
customer.html
<html lang="en" ng-app="crmCustomer">
angular.module('crmCustomer', ['customers']);
sales.html
<html lang="en" ng-app="crmSales">
angular.module('crmSales', ['customers','cart','sales']);
afterSales.html
angular.module('crmAfterSales', ['customers', 'remittance']);
<html lang="en" ng-app="crmAfterSales">
发布于 2015-05-05 11:14:50
我发现在一个页面中使用多个应用程序是很累人的(正如你可以在Amruth链接的解决方案中看到的那样),而不是解决任何问题。
相反,我创建了一个“root”应用程序,并添加了我需要的模块,例如:
angular.module('crm', ['customers', 'cart', 'sales']);只需确保这些模块中的组件有不同的名称,也许是前缀。
https://stackoverflow.com/questions/30050974
复制相似问题