Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ng-node-compile

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-node-compile

Compile angular templates, on Server side!

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
59
increased by25.53%
Maintainers
1
Weekly downloads
 
Created
Source

ng-node-compile

Compile html templates the angular way, in node js! this is a pretty new package, so don't hesitate adding issues or pull requests!

new ngcompile().$interpolate("hello {{name}}")({ name: 'Jhon doe' });

Install

$ npm install ng-node-compile

How to Use?

The library exposes several angular services, which will let you compile angular templates inside node:

###ngcompile this is the function to create a angular enviorment. just

var ngEnviorment = new ngcompile([modules],[angularPath]);

arguments:

  • modules: optional. list of modules to inject to angular enviorment

  • angularPath: optional. path to angular.js file, in case you want another angular version.

###$interpolate:

var ngcompile = require('ng-node-compile');
var ngEnviorment = new ngcompile();
ngEnviorment.$interpolate("hello {{name}}")({ name: 'Jhon doe' });

this wil return a string "hello Jhon doe"

###$compile:

var ngcompile = require('ng-node-compile');
var ngEnviorment = new ngcompile();
ngEnviorment.$compile("<div ng-repeat=\"n in [1,2,3,4,5]\">hello {{name}} {{n}}</div>")({ name: 'Jhon doe' });

this wil return the following HTML:

<div ng-repeat="n in [1,2,3,4,5]" class="ng-binding ng-scope">hello Jhon doe 1</div>
<div ng-repeat="n in [1,2,3,4,5]" class="ng-binding ng-scope">hello Jhon doe 2</div>
<div ng-repeat="n in [1,2,3,4,5]" class="ng-binding ng-scope">hello Jhon doe 3</div>
<div ng-repeat="n in [1,2,3,4,5]" class="ng-binding ng-scope">hello Jhon doe 4</div>
<div ng-repeat="n in [1,2,3,4,5]" class="ng-binding ng-scope">hello Jhon doe 5</div>

Keywords

FAQs

Package last updated on 15 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc