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 id="app-one">
<hr />
<div id="app-two">
              // populate the $templateCache with some templates so we don't
// need extra external files.
angular.module('template1.html', [])
    .run(['$templateCache', function($templateCache) {
        $templateCache.put('template1.html', '<h1>app-one</h1><br /><label>Foo:</label> {{obj.foo}}<br /><label>Bar:</label> {{obj.bar}}<br />');

// create a base app that, for a given directive uses
// an ootb template
angular.module('app-one', [
    .provider('myDirective', [function() {
        this.templateUrl = 'template1.html';
        this.$get = [function() {
            return {
                restrict: 'E',
                templateUrl: this.templateUrl,
                link: function($scope) {
                    $scope.obj = {
                        foo: 'bar',
                        bar: 'baz'
    .directive('myDirective', ['myDirective', function(myDirective) {
        return myDirective;

// create a second app that does nothing other than over-ride
// a directive's template
angular.module('template2.html', [])
    .run(['$templateCache', function($templateCache) {
        $templateCache.put('template2.html', '<h1>app-two</h1><pre>{{obj | json}}</pre>');

angular.module('app-two', [
]).config(['myDirectiveProvider', function(myDirectiveProvider) {
    myDirectiveProvider.templateUrl = 'template2.html';

// since want to place two apps in a single document use angular.bootstrap
// rather than ng-app
angular.bootstrap($('#app-one'), ['app-one']);
angular.bootstrap($('#app-two'), ['app-two']);
Loading ..................