div内的UI-Router默认视图 [英] UI-Router default view inside div

查看:29
本文介绍了div内的UI-Router默认视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有 index.html:

//内容

是否可以将内容放在 div 中作为默认路由?因此,无需包含或其他任何内容,只需在该 div 中直接放置一些标记即可.

解决方案

有一个工作plunker

这是可能的,而且非常简单.所以,让我们在 index.html 中加入这个

这是ui-view的内容,用作默认状态的模板

这可能是默认状态,否则

$urlRouterProvider.otherwise('/default');//状态$stateProvider.state('默认', {网址:/默认",})

此处

检查

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.

解决方案

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

这篇关于div内的UI-Router默认视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆