Git Product home page Git Product logo

Comments (4)

sghgw avatar sghgw commented on June 27, 2024

I have the same problem and the same error after adding a view to my project. When I try to access the App variable from the browser console, I get this error: ReferenceError: App is not defined. But App is available after running this in the console: App = require('app')
Afterwards the view is could be appended to the DOM by running: App.ImageView.create().append()
But is there a way to get views working in an Ember template?

from brunch-with-ember-reloaded.

sghgw avatar sghgw commented on June 27, 2024

For me it works to define App = require 'app' in initializer.coffee as a global variable. I did the following:

  1. Changed App = require 'app' to @App = require 'app' in initializer.coffee
  2. Added the @-sign to all other calls for App in this file
  3. Deleted require 'app' in all files for routes, controllers, models, views and so on.
  4. Replaced module.exports = App.Something = Ember.Something.extend with @App.Something = Ember.Something.extend
  5. Changed {{ view App.SomeView }} to {{ view @App.SomeView }} (It also works with {{ view App.SomeView }})

After this changes my views were rendered correctly and the App variable was available from the browsers console.

I hope this will help.

from brunch-with-ember-reloaded.

wehlutyk avatar wehlutyk commented on June 27, 2024

I've just finished battling with a very similar problem, for which the solution might be the same: when defining models with any kind of relationship (hasMany, belongsTo) to other models, those related models are not found and the initial model can't load (You specified a hasMany ([model 2]) on [model 1] but [model 2] was not found., leading to an Error while loading route: [...]).

It seems Ember needs the App object to be available globally, as is done in Brunch with Hampsters: in initialize.coffee, line 1 is

window.App = require 'app'

instead of

App = require 'app'

which makes related models work like a charm. It strikes me as the same problem.

from brunch-with-ember-reloaded.

gcollazo avatar gcollazo commented on June 27, 2024

Closing because I've stopped using this skeleton. Moved to ember-cli.

from brunch-with-ember-reloaded.

Related Issues (14)

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.