Giter Club home page Giter Club logo

ember-data-route's Introduction

Ember Data Route Build

ember-data-route is built and maintained by DockYard, contact us for expert Ember.js consulting.

About

Ensure you clean up after your models.

Any routes you deactivate will check the model to ensure it is not unsaved. If it is it will either rollback or remove the model from the store depending if has been previously persisted.

Install

npm install ember-data-route --save-dev

Usage

Add the mixin to any route you want:

import Ember from 'ember';
import DataRoute from 'ember-data-route';

export default Ember.Route.extend(DataRoute, {
  ...
});

Transition Confirmation

By default when you transition out of the route the data model is rolled-back/removed automatically after the router is deactivated. However, you may want to detect if this is going to happen and alert the user of changes that will be lost. Typically you could use window.confirm to allow the user to decide to proceed or not. In the route you are mixing into you can provide your own willTransitionConfirm function to handle this. By default this function returns true and is passed the transition object as an argument for you to handle. One possible override could be:

export default Ember.Route.extend(DataRouteMixin, {
  willTransitionConfirm: function() {
    return window.confirm("You have unsaved changes that will be lost. Do you want to continue?");
  }
});

Authors

We are very thankful for the many contributors

Versioning

This library follows Semantic Versioning

Want to help?

Please do! We are always looking to improve this gem. Please see our Contribution Guidelines on how to properly submit issues and pull requests.

Legal

DockYard, Inc © 2014

@dockyard

Licensed under the MIT license

ember-data-route's People

Contributors

bcardarella avatar daniel-xu avatar dguettler avatar kimroen avatar michaeldupuis-dockyard avatar nicomihalich avatar rwjblue avatar xiphiasuvella avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.