Skip to content

nowk/js-ngpush

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ngPush

Browserify Build Status David DM

Push to ngModel bootstrapper

A simple way to bootstrap collections without making extra XHR calls or embedding JSON data in your HTML.

Install

npm install js-ngpush

Usage

require("angular");
require("js-ngpush");

var m = angular.module("App", [
  "ngPush"
]);

m.controller("FilesCtrl", ["$scope", function($scope){
  $scope.files = [];
}]);

Data (something to this effect)

files := []File{
  {Name: "file1.txt", Size: 123},
  {Name: "file2.txt", Size: 456},
}

HTML

<section data-ng-controller="FilesCtrl">
  <% range .Files %>
    <ng-push ng-model="files" data-name="<% .Name %>" data-size="<% .Size %>"></ng-push>
  <% end %>
</section>

Results in

$scope.files = [
  {name: "file1.txt", size: "123"},
  {name: "file2.txt", size: "456"}
];

License

MIT

About

Push to ngModel bootstrapper

Resources

Stars

Watchers

Forks

Packages

No packages published