摘要:
简单模拟了一下angularjs的DI.注入器,简单思路: 1 Injector容器供用户注入 2 监听onload事件,找到controller,然后执行对应方法var Injector = (function(){ window.onload = compile; function compile(){ $("[controller]").each(function(ctrl){ var methodName = $(this).attr("controller"); var method ... 阅读全文