Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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

              
                <body ng-app="RandomQuoteGenerator" ng-cloak>
  <div id="rqg" ng-controller="quoteController as qc">
    <div class="container">
      <div class="row top">
        <div class="col-sm-12">
          <h1>Random Quote Generator</h1>
          <button ng-click="qc.refresh()" class="btn btn-primary"><i class="fa fa-refresh"></i> New quote</button>
        </div>
      </div>
      <div class="row">
        <div class="col-sm-12">
          <div class="rqg_wrap">
          <div class="the-quote">{{ qc.quote.quote }}</div>
          <div class="author">	{{ qc.quote.author }}</div>
          <a class="tweet"
  ng-href="https://twitter.com/intent/tweet?text={{ qc.quote.quote }}%20—	{{ qc.quote.author }}&hashtags=freecodecamp,randomquotes"><i></i> Tweet</a>
        </div>
        </div>
      </div>
    </div>
  </div>
</body>
              
            
!

CSS

              
                $color-main: #010101;
$color-white: #ffffff;
$color-name: #FFA400;
$color-blue: #009FFD;
$color-blue-dark: #1C77C3;

@import url(https://fonts.googleapis.com/css?family=Oleo+Script:400,700);
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,600italic,600,400italic,700);

* {
  outline: none!important;
}

body {
  background: url(https://s-media-cache-ak0.pinimg.com/originals/13/96/52/13965208884bd6236c45fbadf6325604.jpg) no-repeat bottom center;
  background-size: cover;
  background-attachment: fixed;
  font-family: 'Open Sans', sans-serif;
}

#rqg {
  .top {
    text-align: center;
    h1 {
      font-family: "Oleo Script", cursive;
      color: $color-main;
      font-weight: bold;
    }
    button {
      margin-top: 10px;
      font-size: 18px;
      background: $color-blue;
      border: none;
      &:hover {
        background: $color-blue-dark
      }
    }
  }
  .rqg_wrap {
    position: relative;
    text-align: center;
    border-radius: 20px;
    background: white;
    max-width: 600px;
    min-height: 250px;
    height: 100%;
    margin: 30px auto 20px;
    box-shadow: -5px 5px 15px 0px lighten($color-main, 35%);
    .the-quote {
      font-family: "Oleo Script", cursive;
      font-size: 27px;
      padding: 30px 30px 20px;
      &:before {
        content: open-quote;
      }
      &:after {
        content: close-quote;
      }
    }
    .author {
      font-size: 20px;
      font-family: 'Open Sans', sans-serif;
      font-weight: bold;
      margin-bottom: 60px;
      color: lighten($color-main, 50%);
      &:before {
        content: '— ';
      }
    }
    a {
      position: relative;
      height: 28px;
      padding: 1px 10px 1px 9px;
      border-radius: 4px;
      font-weight: 500;
      color: #fff;
      cursor: pointer;
      background-color: #1b95e0;
      box-sizing: border-box;
      font-size: 16px;
      position: absolute;
      bottom: 20px;
      right: 30px;
      text-decoration: none;
      &:hover {
        background-color: #0c7abf;
      }
      i {
        position: relative;
        display: inline-block;
        background: transparent 0 0 no-repeat;
        top: 4px;
        width: 18px;
        height: 18px;
        background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2072%2072%22%3E%3Cpath%20fill%3D%22none%22%20d%3D%22M0%200h72v72H0z%22%2F%3E%3Cpath%20class%3D%22icon%22%20fill%3D%22%23fff%22%20d%3D%22M68.812%2015.14c-2.348%201.04-4.87%201.744-7.52%202.06%202.704-1.62%204.78-4.186%205.757-7.243-2.53%201.5-5.33%202.592-8.314%203.176C56.35%2010.59%2052.948%209%2049.182%209c-7.23%200-13.092%205.86-13.092%2013.093%200%201.026.118%202.02.338%202.98C25.543%2024.527%2015.9%2019.318%209.44%2011.396c-1.125%201.936-1.77%204.184-1.77%206.58%200%204.543%202.312%208.552%205.824%2010.9-2.146-.07-4.165-.658-5.93-1.64-.002.056-.002.11-.002.163%200%206.345%204.513%2011.638%2010.504%2012.84-1.1.298-2.256.457-3.45.457-.845%200-1.666-.078-2.464-.23%201.667%205.2%206.5%208.985%2012.23%209.09-4.482%203.51-10.13%205.605-16.26%205.605-1.055%200-2.096-.06-3.122-.184%205.794%203.717%2012.676%205.882%2020.067%205.882%2024.083%200%2037.25-19.95%2037.25-37.25%200-.565-.013-1.133-.038-1.693%202.558-1.847%204.778-4.15%206.532-6.774z%22%2F%3E%3C%2Fsvg%3E");
      }
    }
  }
}

@media only screen and (max-width: 480px) {
  #rqg {
    .rqg_wrap {
      .the-quote {
        font-size: 20px;
      }
      .author {
        font-size: 16px;
      }
    }
  }
}
              
            
!

JS

              
                var app = angular.module('RandomQuoteGenerator', []);
app.controller('quoteController', quoteController);
app.factory('quoteFactory', quoteFactory);

quoteFactory.$inject = ['$http'];
function quoteFactory($http) {
  return {
    getQuotes: getQuotes
  };

  function getQuotes(){
    return $http.get('https://raw.githubusercontent.com/KarafiziArtur/random-quote-generator/master/quotes.json')
      .then(getQuotesComplete)
      .catch(getQuotesFailed);
  }

  function getQuotesComplete(quotesBase){
    return quotesBase.data;
    console.log('Loading quotes success');
  }

  function getQuotesFailed(error){
    console.log('Loading quotes failed' + error.data);
  }
}

quoteController.$inject = ['quoteFactory'];
function quoteController(quoteFactory){

  var vm = this;
  vm.refresh = function(){
    getQuotes();
  }
  
  getQuotes();
    
  function getQuotes(){
    return quoteFactory.getQuotes().then(function(data){
      vm.quote = data[Math.floor(Math.random()*data.length)];
      return vm.quote;
    });
  }
}
              
            
!
999px

Console