angularjs文档中的一些疑问

比如说下面这个页面:
https://code.angularjs.org/1.4.7/docs/api/ngRoute/provider/$routeProvider

讲$routeProvider的when方法的route参数中,标识每个属性的类型的这些字符串是什么意思?

template – {string=|function()=}
    {Array.<Object>}
    
resolve - {Object.<string, function>=}

{string=|function()=} 中的 “function()=” 是什么意思?
{Array.<Object>} 是什么意思?
{Object.<string, function>=} 中的 “function>=” 又是什么意思?

阅读 2.8k
1 个回答

template 参数可以是写死的 string ,也可以是动态的 function,如:

$route.when("/user", {
   template: "tpl-user.html"
});
$route.when("/user", {
   template: function(params) {
      return "tpl-user.html";
   }
});
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进