problem about ember-old-router-Collection of common programming errors


  • sly7_7
    ember.js ember-old-router
    I’m trying to use an already instantiated controller in my ember route.Is it not normal to ever have instantiated a controller and want to use that in a route? I know that if I the application instantiate a controller for me, I can then to router.get(“myController”) but that won’t access one that I had instantiated myself. How do I get the piece of code at the bottom of my router to work?HTML<script type=”text/x-handlebars” data-template-name=”application”>{{outlet}}</script><sc

  • Alexander Hauer
    ember.js ember-old-router
    I have the following problem with ember.I have a table with a set of datas. I have an event that returns me the current element of the table. Then it opens another view by transitioning into a new state and writes the selected table data in a textfield.click: function(e) {var element = $(e.target).closest(“td”);App.tee = element.text().trim();var router;router = this.get(‘controller.target.router’);router.transitionTo(‘newRoute’)As you can see I have some other routes in my router as well. The

  • sly7_7
    javascript asp.net-web-api ember.js ember-data ember-old-router
    I’m currently trying to put something together with ember + emberdata + router + asp.net web api. Most of it seem to work, however I stuck in an error message I get when ember-data tries to findAll through the adapter for my models.In my backend I have a model like this (C#):public class Genre {[Key]public int Id { get; set; }[Required][StringLength(50, MinimumLength=3)]public string Name { get; set; } }Which in my app I represent it like this using ember-data:App.Genre = DS.Model.extend({id: DS

  • sly7_7
    ember.js ember-old-router
    I have a nested route structure that allows for pagination / sorting / searching that will essentially tweak the ArrayController in some way. The problem I have with the current implementation is that everything is required to get a valid page to render.http://localhost:8000/#/page/1/sort/username/search/daveIf I only pass the page I get the errorUncaught Error: assertion failed: Could not find state for pathAm I missing something in the nested routes or do I need to mark sort/search as optional

  • sly7_7
    javascript coffeescript ember.js ember-old-router
    I’m trying to understand emeber.js routing. I’m not really sure, why this is not valid definition of routerPlatby.Router = Ember.Router.extend location: ‘hash’ enableLogging : trueroot: Ember.Route.extendindex: Ember.Route.extendroute: ‘/’initialState: ‘batches’enter: (router) -> console.log ‘root.index’batches: Ember.Route.extendinitialState: ‘index’route: ‘/batches’enter: (router) -> console.log ‘root.index.batches’index: Ember.Route.extendroute: ‘/’enter: (router) -> console.log

  • sly7_7
    ember.js ember-old-router
    Anyone have any ideas why I’m getting this error:Uncaught TypeError: Cannot redefine property: __ember1346884664897 when calling:App.get(‘router’).send(‘tags’)I’m making the call from one of my views, the router is in the correct state, and as far as I can tell I’m doing everything by the book.Would really appreciate any ideas…Created a gist that might help explain things a little better. https://gist.github.com/3647288

  • Yehuda Katz
    ember.js ember-data ember-old-router
    I get this assertion when run the code below:Emptying a view in the inBuffer state is not allowed and should nothappen under normal circumstances. Most likely there is a bug in yourapplication. This may be due to excessive property changenotifications.Link to demo: http://plnkr.co/edit/s3bUw4JFrJvsL690QUMivar App = Ember.Application.create({Store: DS.Store.extend({revision: 4,adapter: DS.FixtureAdapter.create()}),Router: Ember.Router.extend({root: Ember.Route.extend({index: Ember.Route.extend({r

  • sly7_7
    ember.js ember-old-router
    I have a fairly large example but the issue is that when I transition to the pagination route the first time -all is good. But if I try to click on another (kicking off the pagination event) I get the error belowI don’t have a jsfiddle because this is using ember-data and the objects are databound to my REST endpoint.The ember version is pre 1.0 using the latest ember-data + handlebars-1.0.0.beta.6 and jQuery 1.7.2Uncaught Error: could not respond to eventpaginateUsers in state root.paginated.H

  • sly7_7
    ember.js ember-old-router
    Regarding the new Ember.js routing system (described here), if I understand correctly, views are destroyed when you exit a route. Is there any way to bypass destruction of views upon exiting a route, so that the state of the view is preserved when the user re-enters the route?Update: Looks like, views are not destroyed unless the outlet view is being replaced in the new route. For e.g., if you are in stateA with ViewA in some {{outlet master}} and you go to stateB with ViewB in {{outlet master}}

  • sly7_7
    ember.js nesting ember-old-router
    I have the following code. (I’ll just copy the router, since the application has arround 500 lines at the moment) What I need, is to switch from state ‘rooms’ to ‘guests.new’.When i get to rooms state, it loads a template where i call the action ‘newGuest’ in order to change the state to the ‘newGuest’ screen. But i can’t get it to work. On firebug I get this error:g[a] is undefinedHere’s the router code. Hope you can help me.App.Router = Ember.Router.extend({enableLogging:true,location:’hash’,g

  • sly7_7
    ember.js ember-old-router
    I have a simple template that loops over a ember-data model. Inside the loop I want to provide a simple anchor tag that passes the id of the element along to the router so I can transition to another ember view. What I have below shows “undefined” in the href when I hover over the link, but when I log the content in the route it’s the ember-data model (not just the id as I’d like it to be).<script type=”text/x-handlebars” data-template-name=”session”>{{#each session in controller}}{{sessio

  • sly7_7
    ember.js ember-data ember-old-router
    I have compiled this example from various documentation and examples that I’ve found, but I haven’t found a complete example using a Router and ember-data to simply create a new record, so this is my whack at it. The Examplehttp://jsfiddle.net/dmazza/Hb6BQ/4/I have a person (DS.Model) with a firstName and lastName. I have a Router with index and create routes, where the create form appears in the outlet of the PeopleView. I’m using Ember.TextField’s bound to the attributes of a new Person create

  • sly7_7
    ember.js ember-old-router
    I’m facing a problem with emberJS and the Router.My route architecture is the one below :rootindex apphome itemdisplay/:id edit/:idWhen I initialy navigate to display/:id the URL is well written as below :localhost/#/app/item/display/da083d21-afab-4620-8a85-6a4e6bfb95b9Then I hit the refresh button of my browser and the URL is then written as localhost/#/app/item/display/undefinedI have the following functions in my route to handle serialize/deserialize deserialize: function(router, context) {r

  • sly7_7
    coffeescript ember.js ember-old-router
    I have a ember route that uses a date parameter to retrieve a collection of events. I am using the deserialize function to fetch the collection. After the collection is fetched the url changes from “/day/2012-10-08” to “/day/undefined”. The events include a range of dates so I can’t use the data to serialize the date parameter. Instead I should be able to return the params on the url. My example below sets an attribute on the router “current_params” on deserialize and returns it on serialize. I

  • sly7_7
    ember.js handlebars.js ember-old-router
    I’m writing a simple sort / pagination controller using ember pre 1.0. I want to change the sort property on the controller when the user clicks a column header on the table. I have a simple action helper that points to my routers sortUser method but I can’t seem to pass in a raw string that the route can use as the param such as “username” or “id”Also my url seems broken (getting this url)http://localhost:8000/#/sort/undefinedinstead ofhttp://localhost:8000/#/sort/usernameThank you in advance&l

  • c4p
    ember.js ember-old-router
    I am just starting with emberjs. I am creating a simple index.html page with two links on top: About and Posts. This is following the standard example on emberjs homepage. I get an error in the browser”Uncaught TypeError: Cannot call method ‘map’ of undefined” So this means that my router is undefined. Why is that?Here is the app.js code:var App = Ember.Application.create();App.router.map(function(){});So I tried to define it …var App = Ember.Application.create();App.Router = Ember.Router.exte

  • sly7_7
    ember.js ember-data ember-old-router
    I need to use two computed properties in the url of my app, but when make the transition they say undefined.Here is my code:App.PostController = Ember.ObjectController.extend({updated_at: null,year: function() { var updated_at = this.get(‘updated_at’);return moment(updated_at).format(‘YYYY’);}.property().cacheable(),month: function() {var updated_at = this.get(‘updated_at’);return moment(updated_at).format(‘MM’);}.property().cacheable() });App.Router = Ember.Router.extend({location: ‘