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.

            
              <html ng-app="ionicApp">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">

    <title>Ionic Template</title>

    <link href="https://code.ionicframework.com/0.9.27/css/ionic.min.css" rel="stylesheet">
    <script src="https://code.ionicframework.com/0.9.27/js/ionic.bundle.min.js"></script>
</head>
<body>

<!-- ALL VIEW STATES LOADED IN HERE -->
<ion-nav-view></ion-nav-view>

<script id="entry.html" type="text/ng-template">
    <ion-nav-bar animation="nav-title-slide-ios7"
                 type="bar-positive"
                 back-button-type="button-icon"
                 back-button-icon="ion-ios7-arrow-back">
    </ion-nav-bar>

    <ion-view title="{{navTitle}}" class="bubble-background">

        <ion-content has-header="true" padding="true">

            <h1>Entry Page!</h1>

            <a class="button button-positive" ng-click="signIn()" ui-sref="main.home">Sign In</a>

        </ion-content>

    </ion-view>

</script>

<script id="tabs.html" type="text/ng-template">
    <ion-view title="{{navTitle}}"  left-buttons="leftButtons">

        <ion-tabs tabs-type="tabs-icon-only">
            <ion-tab title="Tab 1" icon-on="ion-ios7-filing" icon-off="ion-ios7-filing-outline">
                <ion-content has-header="true" padding="true">
                    <h2>Tab 1 Content</h2>
                </ion-content>
            </ion-tab>

            <ion-tab title="Tab 2" icon-on="ion-ios7-filing" icon-off="ion-ios7-filing-outline">
                <ion-content has-header="true" padding="true">
                    <h2>Tab 2 Content</h2>
                </ion-content>
            </ion-tab>

            <ion-tab title="Tab 3" icon-on="ion-ios7-filing" icon-off="ion-ios7-filing-outline">
                <ion-content has-header="true" padding="true">
                    <h2>Tab 3 Content</h2>
                </ion-content>
            </ion-tab>
        </ion-tabs>


    </ion-view>
</script>

<script id="mainContainer.html" type="text/ng-template">

    <ion-side-menus>

        <ion-pane ion-side-menu-content>
            <ion-nav-bar type="bar-positive"
                         back-button-type="button-icon"
                         back-button-icon="ion-ios7-arrow-back"
                         animation="nav-title-slide-ios7"
                >

             </ion-nav-bar>
            <ion-nav-view name="main"></ion-nav-view>
        </ion-pane>

        <ion-side-menu side="left">
            <header class="bar bar-header bar-assertive">
                <div class="title">Side Menu</div>
            </header>
            <ion-content has-header="true">
                <ul class="list">
                    <a ui-sref="entry" class="item">Back To Entry Page</a>
                    <a ui-sref="main.home" class="item" ng-click="toggleMenu()">Home</a>
                    <a ui-sref="main.tabs" class="item" ng-click="toggleMenu()">Tabs</a>
                </ul>
            </ion-content>
        </ion-side-menu>

    </ion-side-menus>


</script>


<script id="home.html" type="text/ng-template">
    <ion-view title="{{navTitle}}" left-buttons="leftButtons">

        <ion-content has-header="true" padding="true">

            <h1>Home Page!</h1>
            <img src="https://ununsplash.imgix.net/photo-1423753623104-718aaace6772?q=75&fm=jpg&s=1ffa61419561b5c796bca3158e7c704c" style="max-width: 100%;" />
            <a ui-sref="main.info" class="button button-positive">Info</a>

        </ion-content>

    </ion-view>

</script>

<script id="info.html" type="text/ng-template">
    <ion-view title="{{navTitle}}" left-buttons="leftButtons">

        <ion-content has-header="true" padding="true">

            <h1>Info Page!</h1>

        </ion-content>

    </ion-view>

</script>

</body>
</html>

            
          
!
            
              body {
  cursor: url('https://ionicframework.com/img/finger.png'), auto;
}
            
          
!
            
              angular.module('ionic.ion.imageCacheFactory', [])

.factory("$ImageCacheFactory", function($q,$timeout){
	return {
		Cache: function(urls){
			var promises = [];
			for(i=0;i<urls.length;i++){
				var deferred = $q.defer();
				var img = new Image();
				img.onload = (function(deferred){
					return function(){
						deferred.resolve();
					}
				})(deferred);
				
				img.onerror = (function(deferred,url){
					return function(){
						deferred.reject(url);
					}
				})(deferred,urls[i]);

				promises.push(deferred.promise);
				img.src = urls[i];
			}
			return $q.all(promises);
		}
	}
});

angular.module('ionicApp', ['ionic','ionic.ion.imageCacheFactory'])
.run(function($ImageCacheFactory){
 
  $ImageCacheFactory.Cache(["https://ununsplash.imgix.net/photo-1423753623104-718aaace6772?q=75&fm=jpg&s=1ffa61419561b5c796bca3158e7c704c"]).then(function(){
    console.log("done preloading!");
  });
})
    .config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {

        $stateProvider
            .state('entry', {
                url : '/entry',
                templateUrl : 'entry.html',
                controller : 'EntryPageController'
            })

            .state('main', {
                url : '/main',
                templateUrl : 'mainContainer.html',
                abstract : true,
                controller : 'MainController'
            })

            .state('main.home', {
                url: '/home',
                views: {
                    'main': {
                        templateUrl: 'home.html',
                        controller : 'HomePageController'
                    }
                }
            })

            .state('main.info', {
                url: '/info',
                views: {
                    'main': {
                        templateUrl: 'info.html',
                        controller : 'InfoPageController'
                    }
                }
            })

            .state('main.tabs', {
                 url: '/tabs',
                 views: {
                     'main': {
                         templateUrl: 'tabs.html',
                         controller : 'TabsPageController'
                     }
                 }
            })

        $urlRouterProvider.otherwise('/entry');
    }])

    .controller('MainController', [ '$scope', function($scope) {
        $scope.toggleMenu = function() {
            $scope.sideMenuController.toggleLeft();
        }
    }])

    .controller('EntryPageController', [ '$scope', '$state', function($scope, $state) {
        $scope.navTitle = 'Entry Page';

        $scope.signIn = function() {
            $state.go('main.home');
        }
    }])

    .controller('HomePageController', [ '$scope', '$state', function($scope, $state) {
        $scope.navTitle = 'Home Page';

        $scope.leftButtons = [{
            type: 'button-icon icon ion-navicon',
            tap: function(e) {
                $scope.toggleMenu();
            }
        }];
    }])

    .controller('InfoPageController', [ '$scope', '$state', function($scope, $state) {
        $scope.navTitle = 'Info Page';

        $scope.leftButtons = [{
            type: 'button-icon icon ion-navicon',
            tap: function(e) {
                $scope.toggleMenu();
            }
        }];
    }])

    .controller('TabsPageController', [ '$scope', '$state', function($scope, $state) {
        $scope.navTitle = 'Tab Page';

        $scope.leftButtons = [{
            type: 'button-icon icon ion-navicon',
            tap: function(e) {
                $scope.toggleMenu();
            }
        }];
    }])

            
          
!
999px
Close

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.

Go PRO

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

Console