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

angular-lazy

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-lazy - npm Package Compare versions

Comparing version 0.1.0 to 0.2.1

34

dist/component-loader-service.js

@@ -11,3 +11,15 @@ 'use strict';

/**
* Provides functionality to load components at runtime.
*/
var ComponentLoaderService = (function () {
/**
*
* @param $q
* @param $ocLazyLoad
* @param $injector
* @param system
*/
function ComponentLoaderService($q, $ocLazyLoad, $injector, system) {

@@ -22,2 +34,10 @@ _classCallCheck(this, ComponentLoaderService);

/**
* Loads a component with the given name. It will automatically look for the component in the components folder.
* E.g. if you pass `popup` it will try to load the component from "components/popup/index".
*
* @param {String} componentName
* @returns {Promise}
*/
_createClass(ComponentLoaderService, [{

@@ -38,9 +58,19 @@ key: 'loadComponent',

}
/**
* Resolves an Angular injectable, e.g. service or constant, from the given component. If ensures that the component
* is loaded before trying to resolve the injectable.
*
* @param {String} componentName
* @param {String} identifier
* @returns {Promise}
*/
}, {
key: 'resolve',
value: function resolve(componentName, serviceName) {
value: function resolve(componentName, identifier) {
var _this2 = this;
return this.loadComponent(componentName).then(function () {
return _this2._$injector.get(serviceName);
return _this2._$injector.get(identifier);
});

@@ -47,0 +77,0 @@ }

@@ -9,2 +9,8 @@ 'use strict';

return System.import(futureState.src).then(function (loadedModule) {
if (futureState.prefetch) {
futureState.prefetch.forEach(function (path) {
return System.import(path);
});
}
return $ocLazyLoad.inject(loadedModule.name || loadedModule.default.name || loadedModule);

@@ -11,0 +17,0 @@ })

@@ -11,2 +11,6 @@ "use strict";

/**
* Wrapper around System
*/
var SystemService = (function () {

@@ -19,2 +23,9 @@ function SystemService() {

key: "import",
/**
* Imports a component from the given path, relative to the baseURL set in SystemJS.
*
* @param {String} path
* @returns {Promise}
*/
value: function _import(path) {

@@ -21,0 +32,0 @@ return System.import(path).catch(function (err) {

6

package.json
{
"name": "angular-lazy",
"version": "0.1.0",
"version": "0.2.1",
"description": "Utilities for projects based on the [Angular Lazy Generator](https://github.com/matoilic/generator-angular-lazy)",

@@ -41,5 +41,7 @@ "main": "index.js",

"babel-preset-es2015": "6.1.18",
"eslint-config-angular-lazy": "^0.1.0",
"gulp": "3.9.0",
"gulp-babel": "6.1.0",
"gulp-protractor": "1.0.0"
"gulp-protractor": "1.0.0",
"gulp-sourcemaps": "1.6.0"
},

@@ -46,0 +48,0 @@ "dependencies": {

@@ -7,3 +7,3 @@ # Angular Lazy

The Angular Lazy module adds a state factory to the future states provider. The factory then takes care of loading your states of type load defined in routes.json at runtime.
The Angular Lazy module adds a state factory to the future states provider. The factory then takes care of loading your states of type `load` defined in [states.json](https://github.com/matoilic/generator-angular-lazy#statesjson) at runtime.

@@ -10,0 +10,0 @@ ## Component Loader Service

function routingConfig($futureStateProvider) {
$futureStateProvider.stateFactory('load', ['$q', '$ocLazyLoad', 'futureState', function($q, $ocLazyLoad, futureState) {
$futureStateProvider.stateFactory('load', ['$q', '$ocLazyLoad', 'futureState', function ($q, $ocLazyLoad, futureState) {
return System
.import(futureState.src)
.then(loadedModule => {
if (futureState.prefetch) {
futureState.prefetch.forEach(path => System.import(path));
}
return $ocLazyLoad.inject(loadedModule.name || loadedModule.default.name || loadedModule);

@@ -7,0 +11,0 @@ })

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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