cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

              <div ng-app="app">
  <header class="header">我是header</header>
  <div ui-view="nav"> <nav class="menu"><a ui-sref="simple">Go to state</a><br>
    <a ui-sref="second">Go to second</a><br>
    <a ui-sref="nameView">Go to named view</a><br>
    <a ui-sref="simple({param:'param'})">Go param</a><br>
    <a ng-href="#/simple/ngHref">Go ngHref</a><br>
    <!--   当使用href链接中有{{}} angular可能未解析,跳转会出错。 所以要使用ng-href-->
    <a href="#/simple/Href">Go Href</a></nav></div>
  <section ui-view class="main">
    <div ui-view="I-Have-Name"></div>
  <footer class="clear">我是footer!</footer>
              .header {
   border: 1px solid green;
  margin-bottom: 10px;
.main {
  float: left;
  margin-left: 20px;

.menu {
  float: left;
   border: 1px solid blue;
.clear {
   border: 1px solid green;
.scope {
  border: 1px solid red;
  margin: 2px 2px ;
              var app = angular.module('app', ['ui.router']);

app.config(function($stateProvider) {

  $stateProvider.state('simple', {
    url: '/simple/:param',
    // url: '/simple?param',
    // url: '/simple/{param}',
    template: viewTemplate,
    // templateUrl: 'xxx.html',
    controller: 'viewCtrl'

  $stateProvider.state('second', {
    url: '/second/',
    template: secondTemplate,

  $stateProvider.state('nameView', {
    url: '/name_view/',
    views: {
      'I-Have-Name': {
        template: nameViewTpl
  $stateProvider.state('nameView.child', {
    url: '/name_view_child/',
    views: {
      'name-view-child': {
        template: nameViewChildTpl


var viewTemplate = '<div class="scope" ><div >time: <b>{{time | date:"mediumTime"}}</div>' +
  '<div>param: {{$stateParams.param}}</div>' +
  '<div>' +
  '  <input ng-model="paramValue"></input>' +
  '  <button ng-click="update(paramValue)">Update</button>' +

var secondTemplate = '<div class="scope"><h2>Hi 我是第2个页面</h2></div>';

var nameViewTpl = '<div class="scope"><h2>Hi 我是name-view</h2> <a ui-sref="nameView.child">Go to nameView Child</a><br><div ui-view="name-view-child"></div></div>';

var nameViewChildTpl = '<div class="scope"><h2>Hi 我是 name-view-child</h2><a ui-sref="^">Go back parent</a><br><a ui-sref="simple">Go back state</a><br></div>'
app.controller('viewCtrl', function($scope, $state, $stateParams) {
  $scope.time = new Date();
  $scope.$stateParams = $stateParams;

  $scope.update = function(value) {
    $state.go($state.current, {
      param: value
Loading ..................