ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
#### AngularJS --- __保证未来可能的代码打包和混淆操作不会出现问题, 依赖注入请勿使用推断模式;__ > <span class="do">正确实践:</span> ```js //声明依赖注入的服务 angular.controller("demoCtrl", ["$scope","$timeout",function($scope,$timeout){ //do sth... }]); ``` > <span class="dont">错误实践:</span> ```js //不声明,采用推断模式 angular.controller("demoCtrl", function($scope,$timeout){ //do sth... }); ``` --- __依赖注入的服务名称请保持可识别性;__ > <span class="do">正确实践:</span> ```js angular.controller("demoCtrl", ["$scope","zhx.filter.service","zhx.table.service", function($scope,zhxFilterService,zhxTableService){ //do sth... }]); ``` > <span class="dont">错误实践:</span> ```js angular.controller("demoCtrl", ["$scope","zhx.filter.service","zhx.table.service", function(scp,fs,ts){ //do sth... }]); ``` --- __ 模块如果使用自执行函数包裹,代码结尾必须使用分号`;`做结尾__ > <span class="do">正确实践:</span> ```js (function(){ var app = angular.module("myApp",[]); //do sth... })(); //结尾必须含有分号;