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.

            
              <div ng-app="camperNewsApp">
  <h1> Camper News </h1>

  <div ng-controller="mainCtrl">
    <div class="story-block" ng-repeat="story in stories">
      <div class="article">
        <p class="title"> {{story.headline}} </p>
        <p class="date"> Posted On: {{story.timePosted | date:''}} </p>
        <a ng-href="{{story.link}}"> <img ng-src="{{story.image}}"></a>
        <p class="story-description"> {{story.storyLink}} </br> <i class="fa fa-star"></i> {{story.rank}} </p>
      </div>
      <div class="author">
        <a ng-href="https://www.freecodecamp.com/{{story.author.username}}" title="{{story.author.username}}">
          <img ng-src="{{story.author.picture}}"> </a>
      </div>
    </div>
  </div>
</div>
            
          
!
            
              html {
  box-sizing: border-box; }

*, *::after, *::before {
  box-sizing: inherit; }

body {
  background: #39538D;
  max-width: 68em;
  margin-left: auto;
  margin-right: auto; }
  body::after {
    clear: both;
    content: "";
    display: table; }

h1 {
  text-align: center;
  font-family: "Lucida Grande", "Tahoma", "Verdana", "Arial", sans-serif; }

.title {
  font-size: 20px;
  font-weight: bold;
  word-wrap: break-word;
  text-align: center; }

.story-block {
  float: left;
  display: block;
  margin-right: 2.35765%;
  width: 31.76157%;
  background: #503C91;
  margin: 10px 5px;
  font-family: "Georgia", "Cambria", "Times New Roman", "Times", serif;
  height: 475px;
  font-size: 15px; }
  .story-block:last-child {
    margin-right: 0; }

.date {
  text-align: center; }

.story-description {
  font-style: italic;
  font-size: 20px;
  background: #2B7E7E;
  height: 100px;
  margin: -2.5px;
  width: 295px; }

.article img {
  width: 295px;
  height: 195px;
  margin: auto 25px 0px 25px;
  z-index: -1; }

.author img {
  height: 80px;
  margin: -50px 10px 0px 0px;
  float: right;
  z-index: 1; }

.fa.fa-star {
  color: #B59926; }

/*# sourceMappingURL=main.css.map */

            
          
!
            
              angular.module('camperNewsApp', [])

.controller('mainCtrl', ['$scope', '$http', function($scope, $http){
	$http.get('https://www.freecodecamp.com/news/hot').success(function(data){
		$scope.stories = data;
		for(i = 0; i < $scope.stories.length; i++){
			if($scope.stories[i].image == ""){
				$scope.stories[i].image  ="https://avatars2.githubusercontent.com/u/9892522?v=3&s=400";
			}
		 }
		console.log(data);
	}).error(function(err){
		console.log(err);
})

}]);

            
          
!
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