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

angular-material-sidenav

v0.1.1

Published

Component that build the same sidenav from official angular material website

Downloads

624

Readme

angular-material-sidenav

Simple component that reproduce the Angular Material Style SideNav Menu from their own website material.angularjs.org. Available Demo

1. Installation
bower install angular-material-sidenav --save
2. Configuration

add sasrio.angular-material-sidenav to your main module's list of dependencies

angular.module('myApp', ['sasrio.angular-material-sidenav'])

use the ssSideNavSectionsProvider as a provider to config your menu items

ssSideNavSectionsProvider.initWithSections([{
	id:		'toogle_1',
	name:	'Section Heading 1',
	type:	'heading',
	children: [{
		name:	'Toogle 1',
		type:	'toggle',
		pages:	[{
			id:		'toggle_item_1',
			name:	'item 1',
			state:	'common.toggle.item1'
		}, {
			id:		'toggle_item_2',
			name:	'item 2',
			state:	'common.toggle.item2'
		}]
	}]
}, {
	id:			'link_1',
	name:		'Simple link to Index state',
	state:		'common.index',
	type:		'link',
	hidden:	true // show menu ('true' for hide menu)
}]);

by default, if hidden property is not set, item will be displayed. So to hide one, just pass property to true.

Also, provide to module the $mdThemingProvider in order to get same colors

ssSideNavSectionsProvider.initWithTheme($mdThemingProvider);

You can check the demo source code of app.js to see more on how you can add items

3. Usage

In order to display your sidenav menu, use the factory ssSideNav to get all sections and send them into the directive , example :

note: update the components to the lastest as some of the implementations have changed (e.g method changeSectionVisible no more exist))

// in your controller, add the factory ssSideNav
angular.module('app.controller', [
	'$timeout',
  	'ssSideNav',
  	function ($timeout, ssSideNav) {
    	$scope.menu = ssSideNav;

		// Show or Hide menu
		ssSideNav.setVisible('link_1');
		ssSideNav.setVisibleFor([{
		  id: 'toggle_item_1',
		  value: true
		}, {
		  id: 'link_1',
		  value: false
		}]);

		$timeout(function () {
		  ssSideNav.setVisible('toogle_2', false);
		});

		$timeout(function () {
			// force selection on child dropdown menu item and select its state too.
			ssSideNav.forceSelectionWithId('toogle_1_link_2');
		}, 1000 * 3);
  }
]);

and of course, in your html view:

<ss-sidenav menu="menu"></ss-sidenav>
4. Customization

Colors are handle using a directive from the gist dh94 mdStyleColor

All sidenav is builded using the primary color configured with `$mdThemingProvider.

If you look the source code, you can easily add new template item, new kind of items and so on...