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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.


Loading ..................