123

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.

            
              <body ng-app="myApp" ng-cloak ng-controller="ProductController as products" layout="column">

  <div class="product-filter" layout>
    <h1 flex class="md-headline">Jackets</h1>
    <div class="sort md-caption" layout>
      <div class="collection-sort" layout="column">
        <md-input-container>
          <label>Filter by:</label>
          <md-select ng-model="products.filterBy">
            <md-option value="{{filter}}" ng-repeat="filter in products.availableFilters">{{filter}}</option>
          </md-select>
        </md-input-container>
      </div>
      <div class="collection-sort" layout="column">
        <md-input-container>
          <label>Sort by:</label>
          <md-select ng-model="products.sortedBy">
            <md-option value="{{sort}}" ng-repeat="sort in products.availableSorts">{{sort}}</option>
          </md-select>
        </md-input-container>
      </div>
    </div>
  </div>

  <section class="catalog" layout layout-wrap layout-align="center">
    <md-card ng-repeat="it in products.catalog" flex="22" flex-sm="46" flex-xs="80" ng-class="{shaded:$mdMedia('xs') }">
      <img src="{{it.imageURL}}"></img>
      <md-card-footer-text layout="column">
        <span class="md-title">{{it.title}} </span>
        <span class="md-subhead">{{it.price}}</span>
      </md-card-footer-text>
    </md-card>
  </section>

</body>

<!--
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.
-->
            
          
!
            
              html {
  background-color: #f6f6f6;
  
  .shaded {
    background-color: rgba(110, 110, 61, 0.09);
    transition: all 500ms ease-in;
  }
  
  body {
    background-color: #f6f6f6;
    margin:0;
    padding:0 30px 30px 30px;
    width:100%;
    height:1400px;
    
    img {
          max-width: 100%;
    }    

    .product-filter {
      padding:30px 20px 0px 10px;
      min-height:100px;
      
      .collection-sort {
        margin-top:-10px;
        &:first-child {
          padding-right: 20px;
        }
      }
    }

    .catalog {
      padding-bottom: 30px;
      md-card {
        display:block;
        padding:2%;
        margin:1px;
        
        // Custom setting since ngMaterial 1.0.0 only
        // supports percentage increments of 5 
        // 4-column Table, except Row 1 to be 2-Columns
        &.flex-22 {
          // max-width: 24% !important;
          // Disable to all varying sizes in Cards
          max-height: 100%;
          box-sizing: border-box;
          flex: 1 1 24%;

          &:first-child, &:nth-child(2) {
            flex : 2 46%;  
          }
        }
        
        @media (min-width: 600px) and (max-width: 959px) {        
          // Custom setting since ngMaterial 1.0.0 only
          // supports percentage increments of 5 
          // 2-column table
          &.flex-sm-46 {
            // max-width: 24% !important;
            // Disable to all varying sizes in Cards
            max-height: 100%;
            box-sizing: border-box;
            flex: 2 46%;
          }        

        }        
        
        // Need this for specificity to override defaults
        // 1-column Table
        @media (max-width: 599px) {        
          &.flex-xs-80 {
            flex: 1 80%;
            // Special override for the 1st & 2nd child default resizing
            &:first-child, &:nth-child(2) {
              flex : 1 80%;  
            }
          } 
        }        
              
        img {
          max-width: 100%;
        }
        md-card-footer-text {
          padding-top:25px;
          text-align: center;
        }
      }
      
    }
    
  }
}


/*
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.
*/
            
          
!
            
              angular.module('myApp', ['ngMaterial'])
.controller('ProductController', function( $scope, $products, $mdMedia) {
    $scope.$mdMedia           = $mdMedia;

    this.filterBy         = "All Jackets";
    this.sortedBy         = "Featured"    
    this.availableFilters = $products.availableFilters;
    this.availableSorts   = $products.availableSorts; 
    this.catalog          = $products.catalog;        
})
.factory('$products',function(){
  return {
    availableFilters : ["All Jackets","2016","jacket","Jackets","layers","Obermeyer","Roxy","womens"],
    availableSorts   : ["Featured","Best Selling","Alphabetically, A-Z","Alphabetically, Z-A","Price, low to high","Price, high to low","Date, new to old","Date, old to new"],
    catalog : makeJackets()    
  };
  
  function makeJackets() {    
    var list=[ ], master = {
      imageURL : "https://cdn.shopify.com/s/files/1/0938/8938/products/10231100205_1_1315x1800_300_CMYK_1024x1024.jpeg?v=1445623369",
      title : "Winter Jacket",
      price : "$99.99"
    }
    
    for (var j=0;j<6;j++) {
      list.push(angular.extend({},master));
    }    
    return list;    
  }
  
})


            
          
!
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.

Console