Go back to the main page

Properly constructing a Coffeescript Array of Objects

 

  data: ->
    categories:[
      label: "annhhx10"
      category: "Products"
    ,
      label: "zippers"
      category: "Products"
    ,
      label: "bizdev"
      category: "Charts"
    ,
      label: "loadables"
      category: "Charts"
    ]

  // Outputs

  SelectableDropdown.prototype.data = function() {
    return {
      categories: [
        {
          label: "annhhx10",
          category: "Products"
        }, {
          label: "zippers",
          category: "Products"
        }, {
          label: "bizdev",
          category: "Charts"
        }, {
          label: "loadables",
          category: "Charts"
        }
      ]
    };
  };

  • Pushed on 06/06/2013 by Christian