Closed hashg closed 10 years ago
in eak you should basically never reference globals.
{{view 'chosen'}}
will look up app/views/choosen.js
within app/views/choosen.js
:
export default Ember.Select.extend({
//..codez
});
@stefanpenner along the same lines, what would be the right way to create a custom object in some controller, for example?
// at app/models/track.js
var Track = Ember.Object.extend();
export default Track;
// at app/controllers/something
var SomethingController = Ember.Controller.extend({
actions: {
makeTrack: function() {
return App.Track.create();
}
}
})
export default SomethingController;
How do I avoid referencing the App
global here?
@mehulkar You would do something like:
import Track from 'appkit/models/track';
var track = Track.create();
awesome. Thanks. Going to take some time to read up on es6 syntax today. Not sure I really understand what's going on.
Oops, I am having the same issue. @stefanpenner I tried what you suggested, but didn't work. What am I doing wrong here? Thx
# views/file.coffee
File = Ember.TextField.extend(
tagName: "input"
attributeBindings: ["name"]
type: "file"
file: null
change: (e) ->
reader = undefined
that = undefined
reader = new FileReader()
that = this
reader.onload = (e) ->
fileToUpload = undefined
fileToUpload = e.srcElement.result
Ember.run ->
that.set "file", fileToUpload
reader.readAsText e.target.files[0]
)
`export default File`
And then in template:
<div class="avatar">
{{view "file" name="image" file=image }}
</div>
Trying to work with this example: http://jsfiddle.net/marciojunior/LxEsF/
I am using two js libraries - chosen and pikaday (I found some code in blogs where commuity has shared how to integrate with Ember). I defined the them this way in previous EAK. It worked untill yesterday, when I migrated to new EAK.
In app.js - CalendarDatePicker repo:
In templates it is used (repo):
{{view App.CalendarDatePicker class="form-control input-lg" valueBinding="from_dt"}}
In app.js - Chosen repo:
In templates it is used as (repo):
{{view App.Chosen content=members value=member optionLabelPath="content.firstname" optionValuePath="content.id" autofocus=true}}
After migrating to latest EAK. I get following errors, when I traverse to route containing these tags. This ERRORS are thrown: