urigo:angular-ui-router

v0.7.0Published 10 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

For the official Meteor ui-router package: https://atmospherejs.com/angularui/angular-ui-router

meteor-angular-ui-router

This package adds the ability to use Blaze templates with ui-router

angular-ui-router package for Meteor.

Install

meteor add urigo:angular-ui-router

Depends on https://atmospherejs.com/angularui/angular-ui-router

Usage

app.js

angular.module('myApp', ['angular-meteor', 'ui.router']);

angular.module("myApp").config(['$stateProvider', '$urlRouterProvider',
    function ($stateProvider, $urlRouterProvider) {
        $urlRouterProvider.otherwise("/");

        $stateProvider
            .state('home', {
                url: "/",
                template: UiRouter.template('home.html')
            })
            .state('state1', {
                url: "/state1",
                template: UiRouter.template('state1.html')
            })
            .state('state1.list', {
                url: "/list",
                template: UiRouter.template('state1.list1.html')
            })
            .state('state2', {
                url: "/state2",
                template: UiRouter.template('state2.html')
            });
    }
]);

partials/state1.html

<template name="state1.html">
    <div>
        <h1>State 1</h1>

        <h3>[[title && title || 'Title is empty']]</h3>
        <span>Input a title: </span>
        <input type="text" ng-model="title">

        <hr/>

        <a ui-sref="state1.list">Show List</a>
        <div ui-view></div>

    </div>
</template>