Z
Z
zozyla2019-06-09 23:04:29
JavaScript
zozyla, 2019-06-09 23:04:29

How to access variable/constant in EmberJS controller?

I have a game controller, I have a setPause method, and I have const statusPause = true/false, how can I access const statusPause from other files, service, etc, to do some kind of checks depending on the status of the game?
If you do this in any file, then undefined is returned instead of bool

let game = require('../controllers/game');
console.log(game.setPause.statusPause);

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Romanov, 2019-06-10
@Kaer_Morchen

Another controller can be accessed via inject

V
Vasily, 2017-07-15
@xxvxx

You have an error due to the fact that in Cordova, by default, only the file:// scheme is available and XHR simply does not work.
The problem can be solved, for example, by setting the whitelist plugin:
Then set permission in config.xml:
<allow-intent href="*://testyroki.abyshev.com/*"/>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question