Angularjs 官网有云:
1)在html 里面 ,有ng-app 的标签里需要定义个id ,id='ng-app';
2)ie 7及以下版本需要json2.js或json3.js,主要用来解析json
3)ie8 以下需要自定义一些指令标签: ng-include,ng-pluralize,ng-view,ng:include,ng:pluralize,ng:view;
综合以上我们把代码总结为:
<!DOCTYPE html> <html lang="en" ng-app="phonecat" id="ng-app"> <head> <!--[if lte IE 7]> <script src="js/json2.js"></script> <![endif]--> <!--[if lte IE 8]> <script> document.createElement('ng-include'); document.createElement('ng-pluralize'); document.createElement('ng-view'); // Optionally these for CSS document.createElement('ng:include'); document.createElement('ng:pluralize'); document.createElement('ng:view'); </script> <![endif]--> </head> </html>
经实践中证明,it's very right !