css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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 Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <html lang="en">

<head>
  <!-- Angular Material style sheet -->
  <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.css">
</head>

<body ng-app="WikiApp" ng-cloak ng-controller="mainCtrl">

  <!-- Material Design Toolbar -->
  <md-toolbar>
    <h1> Wikipedia Search</h1>
    <p>A <a href="https://freecodecamp.com" target="_blank">Free Code Camp</a> Zipline by Nick Burress</p>
  </md-toolbar>
  <!-- form and Material Design input -->
  <form ng-submit='search()'>
    <md-input-container>
      <label>Search Wikipedia for..</label>
      <input type="text" ng-model="searchTerm" required md-maxlength="25" ng-keydown="hideMsg()">
    </md-input-container>

    <md-button class="md-fab md-mini" ng-click='search()'>
      <md-icon class="material-icons">search</md-icon>
    </md-button>
  </form>
  <a ng-hide="noResults" href="http://en.wikipedia.org/wiki/Special:Random" class='nudge-right'>Or visit a random article</a>
  <div class="loading" ng-show="loading"><img src="https://dl.dropboxusercontent.com/u/7673790/gears.gif" /></div>
  
  <div class="no-results" ng-show="noResults"><p>The page  {{searchTerm}} does not exist.  You can <a href="https://en.wikipedia.org/wiki/Wikipedia:Articles_for_creation" target="_blank">ask for it to be created.</a></p>
    <p>There were no results matching the query.</p>
  </div>
  <!-- Results Area -->
  <md-content layout='column'>
    <!-- Start Loop -->
    <md-list ng-repeat="result in data">
      <md-list-item layout='row' href="http://en.wikipedia.org/w/index.php?title={{result.title}}">
        <!-- Material Design Card for results display -->
        <md-card class="animated fadeInUpBig">
          <img class="img-responsive" ng-src="{{result.thumbnail.source || 'https://upload.wikimedia.org/wikipedia/commons/7/7a/Nohat-wiki-logo.png' }}" class="md-card-image" alt="{{result.title}}">
          <md-card-content>
            <h2>{{result.title}}</h2>
            <p>{{result.extract}}</p>
          </md-card-content>
          <md-card-footer>
            <a href="http://wikipedia.org" target="_blank">From Wikipedia.org</a>
          </md-card-footer>
        </md-card>

      </md-list-item>
    </md-list>
  </md-content>
  <!-- End Results -->
  <!-- Angular Material requires Angular.js Libraries -->
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-aria.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-messages.min.js"></script>

  <!-- Angular Material Library -->
  <script src="https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.js"></script>

  

</body>

</html>

<!--
Copyright 2016 Google Inc. All Rights Reserved. 
Use of this source code is governed by an MIT-style license that can be in foundin the LICENSE file at https://material.angularjs.org/license.
-->
            
          
!
            
              h1 {
  color: white;
  font-family: "Roboto Slab"
}

md-toolbar p {
  font-size: 0.8em;
  color: white;
}

a {
  color: orange;
  font-weight: 700;
}

a:hover {
  color: darkblue;
}

.nudge-right {
  margin-left: 25px;
}

md-toolbar {
  padding-left: 20px;
}

md-toolbar p {
  margin-top: 5px;
  margin-left: 5px;
}
md-toolbar h1 {
  margin-bottom: 0;
}

md-card {
  width: 100%;
}

md-card img {
  width: 100px;
}

md-input-container{
  margin-top: 40px !important;
  margin-left: 20px !important;
  width: 40%;
}
a.md-button.md-default-theme:not([disabled]):hover, a.md-button:not([disabled]):hover, .md-button.md-default-theme:not([disabled]):hover, .md-button:not([disabled]):hover {
background-color: rgba(98,220,240,0.18)
}

.loading {
  width: 100%;
  text-align: center;
  
}

.no-results {
  margin-left: 30px;
  margin-top: 0;
}
@media screen and (max-width: 600px){
  md-input-container{
  
  width: 70%;
}
}
            
          
!
            
              (function() {
  angular
    .module("WikiApp", ["ngMaterial"])
    .controller("mainCtrl", [
      "$scope",
      "$http",
      function($scope, $http) {
        $scope.hideMsg = function() {
          $scope.noResults = false;
        };
        $scope.searchTerm = "";
        $scope.search = function() {
          $scope.data = {};
          $scope.loading = true;
          console.log("searching..");
          $http
            .jsonp(
              "https://en.wikipedia.org/w/api.php?format=json&action=query&generator=search&gsrnamespace=0&gsrlimit=20&prop=pageimages|extracts&pilimit=max&exintro&explaintext&exsentences=2&exlimit=max&gsrsearch=" +
                $scope.searchTerm +
                "&callback=JSON_CALLBACK"
            )
            .success(function(data) {
              console.log(data);
              if (!data.query) {
                $scope.noResults = true;
                $scope.loading = false;
              }
              $scope.data = data.query.pages;
              $scope.noResults = false;
              $scope.loading = false;
            })
            .error(function(data) {
              console.log("errors ocurred");
            });
        };
      }
    ])
    .config(function($mdThemingProvider) {
      $mdThemingProvider
        .theme("default")
        .primaryPalette("cyan")
        .accentPalette("orange");
    });
})();

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console