UI-Router default view inside div

丶灬走出姿态 提交于 2019-12-08 07:00:44

问题


Say I have index.html with:

<div ui-view="viewA">
    // content
</div>

Is it posible to put content inside div that will serve to me as default route? So without including or anything else, just need to put some markup directly in that div.


回答1:


There is a working plunker

That is possible, and really pretty easy. So, let's have this inside of index.html

<div ui-view="">

  this is the content of ui-view, 
  which serves as a template for a default state

</div>

And this could be the default state and otherwise

$urlRouterProvider.otherwise('/default');

// States
$stateProvider
  .state('default', {
      url: "/default",
  })

Check it here



来源:https://stackoverflow.com/questions/37648492/ui-router-default-view-inside-div

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!