npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angularplate

v1.0.0

Published

AngularPlate Scaffolding for AngularJS. Create Controllers, Factories and Views from command line.

Downloads

20

Readme

Build Status

AngularPlate

Scaffolding for AngularJS. Create Controllers, Factories and Views from command line.

Install:

npm install angularplate

Install dependencies

npm install

Run:

node app.js

Test

npm test

How to use:

Now you can create:

1. Factories:

  • Factory Name (Required)
  • Attributes: separated by # (name:type:value). Value is optional. Data types allowed: String, Number, Boolean and Array. Example: firstName:string:sergio#age:number:23#hobbies:array:[football,basket]
  • Dependencies: separated by commas. Example: $http,$q

1.1 Example:

AngularPlate!: Enter a name for your factory:  WineFactory

AngularPlate!: Write properties for your factory separated by # (name:type:value) :  name:string#price:number

AngularPlate!: Write dependencies for your factory separated by , :  AnotherService

This generate a .js named WineFactory.js:

  (function() {
    app.factory('WineFactory', WineFactory);
    WineFactory.$inject = ['AnotherService'];
    function WineFactory(AnotherService) {
      var WineFactory = {
        name: null,
        price: null,
      };

      return WineFactory;
    }
  })();

2. Controller + View

  • Controller name (Required)
  • Attributes: separated by # (name:type:value). Value is optional. Data types allowed: String, Number, Boolean and Array. Example: firstName:string:sergio#age:number:23#hobbies:array:[football,basket].
  • Dependencies: separated by commas. Example: $http,$q, ($scope already added).
  • Name of view (Required)

2.1 Example

AngularPlate!: Enter a name for your controller:  WineController

AngularPlate!: Write properties for your controller separated by # (name:type:value) : name:string#price:number

AngularPlate!: Write dependencies for your controller separated by , ($scope already added): AnotherService

AngularPlate!: Name for view: :  WineView

This generate a .js and .html:

//WineController.js
(function() {
  app.controller('WineController', WineController);
  WineController.$inject = ['AnotherService', '$scope'];
  function WineController(AnotherService, $scope) {
    $scope.name = null;
    $scope.price = null;
  }
})();

//WineView.html
<input type="text" ng-model="name">
<input type="number" ng-model="price">

3. Services

  • Service name
  • Services url

3.1 Example

AngularPlate!: Entity name: wine

AngularPlate!: Url:  http://www.mydomain.com/api/wine

This generate a .js file:

//wineService.js
(function() {
  app.service('WineServices', wineServices);
  wineServices.$inject = ['$http', '$q'];
  function wineServices($http, $q) {

    this.getWine = function(id) {
      var deferred = $q.defer();
      var url = 'http://www.mydomain.com/api/wine/' + id;

      $http.get(url)
        .success(deferred.resolve)
        .error(deferred.reject);

      return deferred.promise;
    };

    this.createWine = function(wine) {
      var deferred = $q.defer();
      var url = 'http://www.mydomain.com/api/wine';

      $http.post(url, wine)
        .success(deferred.resolve)
        .error(deferred.reject);

      return deferred.promise;
    };

    this.updateWine = function(wine) {
      var deferred = $q.defer();
      var url = 'http://www.mydomain.com/api/wine';

      $http.put(url, wine)
        .success(deferred.resolve)
        .error(deferred.reject);

      return deferred.promise;
    };

    this.deleteWine = function(id) {
      var deferred = $q.defer();
      var url = 'http://www.mydomain.com/api/wine' + id;

      $http.delete(url)
        .success(deferred.resolve)
        .error(deferred.reject);

      return deferred.promise;
    };


 }
})();

4. Complete CRUD (Controller + View + Service):

  • Entity mame
  • Properties for controller (separated by commas)
  • Dependencies (separated by commas)
  • Framework style
  • API URL

4.1 Example:

AngularPlate!:
Welcome to Angularplate:
What do you create?
 1. Factory
 2. Controller + View
 3. CRUD Service
 4. Complete CRUD (Controller + View + Service)
 0. Exit:  4
AngularPlate!: Enter entity name:  wine
AngularPlate!: Write properties for your controller separated by # (name:type:value)
:  name:string#age:number
AngularPlate!: Write dependencies for your controller separated by , : ($scope already added)
:
AngularPlate!: Framework style:
 1. None 2. Bootstrap 3. Angular Material:  2
AngularPlate!: API URL (example: http://localhost/api/entity):  http://localhost:8090/api/wine
wineView.html created!
wineService.js created!
wineCtrl.js created!

This generate 3 files:

  • wineView.html:
<div class="col-md-2">
  <div class="input-group">
    <span class="input-group-addon">Name</span>
    <input type="text" ng-model="name" class="form-control" aria-describedby="basic-addon1">
  </div>
</div>
<div class="col-md-2">
  <div class="input-group">
    <span class="input-group-addon">Age</span>
    <input type="number" ng-model="age" class="form-control" aria-describedby="basic-addon1">
  </div>
</div>
  • wineServices.js:
(function() {
  app.service('WineServices', wineServices);
  wineServices.$inject = ['$http', '$q'];
  function wineServices($http, $q) {

    this.getWine = function(id) {
      var deferred = $q.defer();
      var url = 'http://localhost:8090/api/wine/' + id;

      $http.get(url)
        .success(deferred.resolve)
        .error(deferred.reject);

      return deferred.promise;
    };

    this.createWine = function(wine) {
      var deferred = $q.defer();
      var url = 'http://localhost:8090/api/wine';

      $http.post(url, wine)
        .success(deferred.resolve)
        .error(deferred.reject);

      return deferred.promise;
    };

    this.updateWine = function(wine) {
      var deferred = $q.defer();
      var url = 'http://localhost:8090/api/wine';

      $http.put(url, wine)
        .success(deferred.resolve)
        .error(deferred.reject);

      return deferred.promise;
    };

    this.deleteWine = function(id) {
      var deferred = $q.defer();
      var url = 'http://localhost:8090/api/wine' + id;

      $http.delete(url)
        .success(deferred.resolve)
        .error(deferred.reject);

      return deferred.promise;
    };


 }
})();
  • wineCtrl.js:
(function() {
  app.controller('WineCtrl', wineCtrl);
  wineCtrl.$inject = ['WineServices', '$scope'];
  function wineCtrl(WineServices, $scope) {
    $scope.name = null;
    $scope.age = null;

    $scope.getWine = function(id) {
      WineServices.getWine(id).then(function(response) {
        console.log(response);
      });
    };

    $scope.createWine = function(wine) {
      WineServices.createWine(wine).then(function(response) {
        console.log(response);
      });
    };

    $scope.updateWine = function(wine) {
      WineServices.updateWine(wine).then(function(response) {
        console.log(response);
      });
    };

    $scope.deleteWine = function(id) {
      WineServices.deleteWine(id).then(function(response) {
        console.log(response);
      });
    };
  }
})();