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 - npm Package Compare versions

Comparing version 1.5.4 to 1.5.5

test/modules/a.js

73

main.js

@@ -6,4 +6,9 @@ var jsdom = require("jsdom-nogyp"),

function ngCompile(modules, angularPath) {
function ngCompile(modules, angularPath, settings) {
if ((!(modules instanceof Array)) && (typeof modules === "object")) {
settings = modules;
modules = [];
}
this.settings = settings || {};
this.modules = modules || [], _self = this;

@@ -13,28 +18,50 @@ this.modules.unshift({ name: 'ng', path: angularPath || path.resolve(__dirname, "angular.js") });

this.env = jsdom.env({
html: '<p></p>',
done: function (errors, window) {
if (errors)
console.log(errors);
else {
global.window = window;
global.document = window.document;
if (!this.envReady) throw new Error(ENVIORMENT_NOT_READY);
var _modules = [];
_self.modules.forEach(function (module) {
require(path.resolve(process.cwd(), module.path));
if (module.name === "ng") global.angular = global.window.angular;
_modules.push(module.name);
});
this._modules = [];
this.modules.forEach(function (module) {
require(path.resolve(process.cwd(), module.path));
if (module.name === "ng") global.angular = global.window.angular;
_self._modules.push(module.name);
});
_self.window = window;
_self.angular = window.angular;
window.angular.injector(_modules).invoke(function ($rootScope, $compile, $interpolate) {
_self.services = { $rootScope: $rootScope, $compile: $compile, $interpolate: $interpolate };
_self.ready = true;
});
}
}
this.window = global.window;
this.angular = window.angular;
if (_self.settings.startSymbol || _self.settings.endSymbol) {
angular.module('ngCompileInterpolateProviderSymbols', []).config(function ($interpolateProvider) {
if (_self.settings.startSymbol) $interpolateProvider.startSymbol(_self.settings.startSymbol.toString());
if (_self.settings.endSymbol) $interpolateProvider.endSymbol(_self.settings.endSymbol.toString());
console.log(_self.settings.startSymbol === '[[' && _self.settings.endSymbol === ']]');
});
this._modules.push('ngCompileInterpolateProviderSymbols');
}
window.angular.injector(this._modules).invoke(function ($rootScope, $compile, $interpolate) {
_self.services = { $rootScope: $rootScope, $compile: $compile, $interpolate: $interpolate };
_self.ready = true;
if (typeof _self.readyCallback === "function") _self.readyCallback();
});
}
ngCompile.prototype.env = jsdom.env({
html: '<p></p>',
done: function (errors, window) {
if (errors)
console.log(errors);
else {
global.window = window;
global.document = window.document;
ngCompile.prototype.envReady = true;
}
}
});
ngCompile.prototype.onReady = function (callback) {
if (this.ready)
callback();
else
this.readyCallback = callback;
}
ngCompile.prototype.$new = function () {

@@ -41,0 +68,0 @@ if (!this.ready) throw new Error(ENVIORMENT_NOT_READY);

{
"name": "ng-node-compile",
"version": "1.5.4",
"version": "1.5.5",
"description": "Compile angular templates, on Server side!",

@@ -9,3 +9,6 @@ "main": "main.js",

},
"devDependencies": {},
"devDependencies": {
"chai": "^3.0.0",
"mocha": "^2.2.5"
},
"scripts": {

@@ -12,0 +15,0 @@ "test": "echo \"Error: no test specified\" && exit 1"

@@ -19,3 +19,3 @@ # ng-node-compile

###ngcompile
**ngcompile**

@@ -53,5 +53,3 @@ this is the function to create a angular enviorment. just

this wil return the following HTML:
##example using express and extra angular moduls:

@@ -92,2 +90,10 @@

![result](https://raw.githubusercontent.com/MoLow/ng-node-compile/master/capture.PNG)
![result](https://raw.githubusercontent.com/MoLow/ng-node-compile/master/capture.PNG)
```html
<div ng-repeat="n in [1,2,3,4,5]" yellow="false" class="ng-binding ng-scope">hello Jhon doe 1</div>
<div ng-repeat="n in [1,2,3,4,5]" yellow="false" class="ng-binding ng-scope">hello Jhon doe 2</div>
<div ng-repeat="n in [1,2,3,4,5]" yellow="true" class="ng-binding ng-scope" style="color: yellow;">hello Jhon doe 3</div>
<div ng-repeat="n in [1,2,3,4,5]" yellow="false" class="ng-binding ng-scope">hello Jhon doe 4</div>
<div ng-repeat="n in [1,2,3,4,5]" yellow="false" class="ng-binding ng-scope">hello Jhon doe 5</div>
```
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