ng-navigation-bar
npm installation
$ npm install ng-navigation-bar
Usage
Load the Angular Module
If you are using Browserify, you just need to require()
the module:
var navbar = ;
Otherwise, you can load dist/navigation-bar.js
in your HTML:
Then, add 'navigationBar'
to your app requirements:
var app = angular;
Add the Styles
If you are using Stylus (and you should!), you can require the Stylus module, which will allows you to define some parameters:
// Each parameter is optionalnavbar-title-color = 0, 0, 0) // Title colornavbar-button-color = 21, 125, 251) // Buttons colornavbar-anim-duration = 0.6s // Animation durationnavbar-timing-function = .1, .7, .1, 1) // Animation easing // Make sure that you define the parameters before the @import@import 'ng-navigation-bar'
If you are not using Stylus, load dist/navigation-bar.css
into your app, and
have a look inside it if you need to change animation settings.
navigation-bar
directive
Use the Add a navigation-bar
element into your template, and a status
attribute on
it, which is an object containing the following properties:
- title: the current title (
String
) - backLabel: the “Back” button label (optional,
String
) - actionLabel: the “Action” button label (optional,
String
) - onBack: the function to call when the “Back” button is clicked (
Function
) - onAction: the function to call when the “Action” button is clicked (
Function
) - move: the current animation, left-to-right or right-to-left ('ltr', 'rtl' or 'none',
String
)
Example
; // Only with Browserify var app = angular; app;