cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmloctocatspinnerstartv

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 ng-app="instagramApp">
  <div ng-controller='InstagramCtrl'>

    <p ng-bind-template="Total number of photos: {{ photos.data.length }}">Total number of photos:</p>
    <p>Sort by:
    <select ng-model="orderProp">
      <option value="created_time">Oldest to Newest</option>
      <option value="-created_time">Newest to Oldest</option>
      <option value="-likes.count">Most Likes</option>
      <option value="likes.count">least Likes</option>
    </select>
    </p>

    <ul>
      <li ng-repeat="photo in photos.data | orderBy:orderProp">
        <a href="#/photos/{{ photo.id }}" data-url="{{ photo.link }}" data-id="{{ photo.id }}" data-created-time="{{ photo.created_time | date : format : timezone}}" data-likes="{{ photo.likes.count }}">
          <img ng-src="{{ photo.images.low_resolution.url }}">
        </a>
      </li>
    </ul>
  </div>
</div>
            
          
!
            
              body {
  font-family: 'helvetica neue', sans-serif;
  font-size: calc(20rem / 16);
  color: #999;
}
ul {
  style-style-type: none;
}
li {
  float: left;
}
p {
  margin-bottom: 20px;
}
a {
  padding: 5px;
  display: block;
  box-sizing: border-box;
}
img {
  width: 220px;
}
[ng-controller='InstagramCtrl'] {
  margin: 50px auto;
  max-width: 1150px;
}
            
          
!
            
              // angular.js
// angular-resource.js

// services.js
var instagramServices = angular.module('instagramServices', ['ngResource']);

instagramServices.factory('Photo', ['$resource', function($resource){

  var user_id = "828057799";
  var client_id = "5e7cb176cc4340c09124d9f50733f34f"; 
  var endpoint = 'https://api.instagram.com/v1/users/'+user_id+'/media/recent/?client_id='+ client_id+'&callback=JSON_CALLBACK';

  return $resource(endpoint, {}, {
    query: {method:'JSONP'}
  });

}]);


// controllers.js
var instagramControllers = angular.module('instagramControllers', [ 'instagramServices']);

instagramControllers.controller('InstagramCtrl', ['$scope', 'Photo', function InstagramCtrl($scope, Photo) {
  $scope.photos = Photo.query();
  $scope.orderProp = '-created_time';
  console.log($scope.photos);
}]);


// app.js
var instagramApp = angular.module('instagramApp', ['instagramControllers']);
            
          
!
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