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.

+ add another resource


Babel includes JSX processing.

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.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <html ng-app="ionicApp">

  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
  <title>Tabs Example</title>
  <link href="//" rel="stylesheet">
  <script src="//"></script>
  <script src="//,places"></script>


  <ion-nav-bar class="bar-positive">


  <script id="templates/tabs.html" type="text/ng-template">
    <ion-tabs class="tabs-icon-top tabs-positive">

      <ion-tab title="Home" icon="ion-home" href="#/tab/home">
        <ion-nav-view name="home-tab"></ion-nav-view>

      <ion-tab title="Map" icon="ion-ios-world" ui-sref="">
        <ion-nav-view name="map-tab"></ion-nav-view>


  <script id="templates/home.html" type="text/ng-template">
    <ion-view view-title="Home">
      <ion-content class="padding">
          <a class="button icon icon-right ion-chevron-right" href="#/tab/map">Go to Map</a>

  <script id="templates/map.html" type="text/ng-template">
    <ion-view title="">
      <ion-nav-buttons side="left">
        <input id="places" class="controls" type="text" autocomplete placeholder="Enter a location" />
      <ion-nav-buttons side="right">
        <a ng-click="centerOnMe()" class="button button-icon icon ion-navigate">Find Me</a>

      <div class="item range range-positive noborder">
        <i class="icon ion-minus-circled" ng-click="zoomOut()"></i>
        <input type="range" min="{{zoomMin}}" max="{{zoomMax}}" ng-model="entry.zoomSize">
        <i class="icon ion-plus-circled" ng-click="zoomIn()"></i>
        <div id="map" data-tap-disabled="true" style="width: 500px;height: 500px"></div>





                #map {
  width: 100%;
  height: 100%;


                angular.module('ionicApp', ['ionic'])

.config(function($stateProvider, $urlRouterProvider) {

    .state('tabs', {
      url: "/tab",
      abstract: true,
      templateUrl: "templates/tabs.html"
    .state('tabs.home', {
      url: "/home",
      views: {
        'home-tab': {
          templateUrl: "templates/home.html",
          controller: 'HomeCtrl'
    .state('', {
      url: "/map",
      views: {
        'map-tab': {
          templateUrl: "templates/map.html",
          controller: 'MapCtrl'



.run(function($rootScope) {
    angular.element(document).ready(function () {
        console.log('dom ready');
        $rootScope.domReady = true;

.controller('HomeCtrl', function($scope) {

.controller('MapCtrl', function($scope, $ionicLoading, $compile, $rootScope, $timeout) {
  function initialize() {
    var myLatlng = new google.maps.LatLng(45.067826, 7.666672);

    var mapOptions = {
      center: myLatlng,
      zoom: 12,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    var map = new google.maps.Map(document.getElementById("map"),

    //Marker + infowindow + angularjs compiled ng-click
    var contentString = "<div><a ng-click='clickTest()'>Click me!</a></div>";
    var compiled = $compile(contentString)($scope);

    var infowindow = new google.maps.InfoWindow({
      content: compiled[0]

    var marker = new google.maps.Marker({
      position: myLatlng,
      map: map,
      title: 'Uluru (Ayers Rock)'

    google.maps.event.addListener(marker, 'click', function() {, marker);

    $ = map;
  google.maps.event.addDomListener(window, 'load', initialize);
  if ($rootScope.domReady === true) initialize();
  $timeout(function () {
    // to wait for next digest cycle and have view completely rendered
    var input = document.getElementById('places');
    $scope.autocomplete = new google.maps.places.Autocomplete(input);
    $scope.autocomplete.bindTo('bounds', $;
    $scope.autocomplete.addListener('place_changed', function() {      
      var place = $scope.autocomplete.getPlace();
      if (!place.geometry) {
        window.alert("Autocomplete's returned place contains no geometry");
      // If the place has a geometry, then present it on a map.
      if (place.geometry.viewport) {
      } else {

  $scope.centerOnMe = function() {
    if (!$ {

    $scope.loading = ${
      content: 'Getting current location...',
      showBackdrop: false

    navigator.geolocation.getCurrentPosition(function(pos) {
      $ google.maps.LatLng(pos.coords.latitude, pos.coords.longitude));
    }, function(error) {
      alert('Unable to get location: ' + error.message);

  $scope.clickTest = function() {
    alert('Example of infowindow with ng-click')