UI-Router default view inside div

2019-06-01 08:04发布

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条回答
一夜七次
2楼-- · 2019-06-01 08:18

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

查看更多
登录 后发表回答