Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4838

Updating to Ember 2.x application.lookup is not a function

$
0
0

@yoshie wrote:

So I finally bit the bullet to update our production Ember app from 1.13.9 to 2.X and I'm already running into issues. Looking into the deprecation list, I changed out all my initializers to use application.lookup instead of container.lookup as per this doc http://emberjs.com/deprecations/v2.x/#toc_ember-applicationinstance-container

But I've been running into "application.lookup is not a function". I've tried reinstalling ember but to no avail. It seems like a simple issue but I haven't figure it out?

Code in question app/initializers/cleardata.js

export function clearStore( application ) {
  application.deferReadiness();
  // the following clears all guest content
  application.lookup('store:main').findAll('guest').then(function(data){
    let guests = data.get('content');
    for ( let i = 0; i < guests.length; i++ ) {
      guests[i].deleteRecord();
      guests[i].save(); }
  });
  application.advanceReadiness();
}
export default {
  name: 'cleardata',
  initialize: clearStore
};

Current build versions:

Ember : 2.5.1

Ember Data : 2.5.2

jQuery : 2.2.3

Ember Simple Auth : 1.0.0

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4838

Trending Articles