Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
angular-named-route
Advanced tools
Readme
Named route support for angular-route. Name your routes so you don't have to copy-paste-replace URLs everywhere. Automatically prefixes <base />
href so that all links created work in HTML 5 mode.
npm install angular-named-route --save
<script src="node_modules/angular-named-route/dist/angular-named-route.js" />
or in case of webpack/browserify and npm
import 'angular-named-route';
//include it in your app
angular.module('myapp', ['ngRoute', 'ngNamedRoute']);
//provide names to routes
angular.module('myapp').config(function($routeProvider) {
$routeProvider.
when('/', {
controller: 'HomeCtrl',
name: 'home'
}).
when('/thing/:id', {
controller: 'ThingCtrl',
name: 'thing-detail'
});
});
//use as a service
angular.module('myapp').controller('ThingCtrl', function (namedRouteService, $location) {
var path;
//reverse to get path string
path = namedRouteService.reverse('home');
//path = '/'
//single param
path = namedRouteService.reverse('thing-detail', 1);
//path = '/thing/1'
//param list
path = namedRouteService.reverse('thing-detail', [1]);
//path = '/thing/1'
//param object
path = namedRouteService.reverse('thing-detail', {id: 1});
//path = '/thing/1'
//query arguments
path = namedRouteService.reverse('thing-detail', 1, {foo: 'bar', 'baz': ['blah', 'meh']});
//path = '/thing/1?foo=bar&baz=blah&baz=meh'
//open immediately
namedRouteService.open('thing-detail', 1);
//is same as
$location.path(namedRouteService.reverse('thing-detail', 1));
});
'named-route' directive to set href attribute:
<a named-route="'home'">home</a>
<a named-route="'thing-detail'" route-params="1">first thing</a>
<a named-route="'thing-detail'" route-params="{id: 1}">first thing</a>
<a named-route="'thing-detail'" route-params="1" route-query-params="{foo: 'bar'}">first thing</a>
npm install gulp-cli -g
npm install
gulp build
npm test
FAQs
named route support for angular-route
We found that angular-named-route demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).