Eskimofo: injecting the validations would be assuming it is a standalone service, which it is not
datazombie has quit
tyleri has quit
Eskimofo
Grapho why, does it have depandencies?
wayne- has quit
evanfreeman has quit
TeknoFiend has quit
Akii joined the channel
choernig has quit
evanfreeman joined the channel
wookiehangover has quit
evanfreeman has quit
evanfreeman joined the channel
qwebirc19092 joined the channel
Grapho
well the mixin taps into the objects init() method to run all its setup
tyleri joined the channel
if it were in a service, it could not do that
jmeas has left the channel
tubbo has quit
gannetson joined the channel
qwebirc19092
how can you set a default template to be render in the {{outlet}} of another template?
Grapho
if it were a service it would need to be designsed to juggle all the validations within itself, rether than letting each object control itso own validationd
qwebirc19092
For example, if I had an ‘assignments’ template that would render all the assignments in the {{outlet}} by default and other stuff when they click other links?
wookiehangover joined the channel
alan_andrade joined the channel
Grapho
qwebirc19092: the 'assignments' would actually want to be the index template for that route.. if you want it in the outlet by default.
qwebirc19092
do i follow a file naming convention to create an index for a template
if im using ember cli?
like assignments.index.hbs?
Grapho
e.g. assignments.index = app/templates/assignments/index.hbs
qwebirc19092
ah ok
thank you
tubbo joined the channel
Grapho
your other routes would be like assignments.new... assignments.edit... assignments.whatever
qwebirc19092
great!
Eskimofo
Grapho ok thanks. i will use it as a mixin
TeknoFiend joined the channel
shinnya joined the channel
Grapho
Eskimofo: the other benefit of a mixin is it would allow you to validate the same model differently depending on what controller it is on.. but anyway good luck!
ForSpareParts joined the channel
dagda1_ joined the channel
darrin has quit
bkaney has quit
gmurphey has quit
samselik_
is it possible to use `fillIn` helper in a component unit test?
highcup
Is the way to create something like a singleton to use an initializer?
gmurphey joined the channel
I've got a resource that I want to keep track of -- you can only ever have one of this resource at any given time, and I would need access to it in any of my routes. So a route would say "give me the next widget"
Does that sound like an object I create in an initializer and tell it to inject into any route?
abuiles
samselik_: then doesn't sound like a unit test
Grapho
highcup: that sounds legit
samselik_
abuiles: hm. it's a validated-input, so i want to test that, if user enters "123", it works, if they enter "abc", it doesnt
ZiggyTheHamster
highcup: use dependency injection and a controller that ensures it has a single reference and that the controller is an injected singleton
samselik_
(and by 'it works' i mean, updates a binding)
tubbo has quit
abuiles
is that a component?
samselik_
{{validated-input value=40}}. render. user enters 'abc' then focuses out. value is still 40.
ZiggyTheHamster
so yeah, what you said :)
highcup
Grapho: and if the object I have in my initializer abstracts network calls to update, does that begin to sound fishy? Or does it still sound right?
samselik_
{{validated-input value=40}}. render. user enters '80' then focuses out. value is now 80
that sort of thing
Grapho
highcup: a service could use ajax if it wants
ZiggyTheHamster
samselik_: I do something like {{validated-input value=attrName object=thing property="attrName"}}
Grapho
or websocket even
highcup
ZiggyTheHamster: if you use a controller for a singleton, do you have to tell it to render on some part of your page for it to work?
ZiggyTheHamster
then the _controller_ does the validation and makes its results available under thing.errors.attrName
highcup: negative
gannetson has quit
TeknoFiend has quit
highcup: actually I think you probably CAN'T have it render if you inject it via initializers, or if you do, it'll be {{render "thing"}} in one place. but it sounds like you don't want that, you just want to be able to get a model and some model-based data
highcup
Right
I'm checking out ember services first -- have not used those yet.
Thanks Grapho, ZiggyTheHamster
Grapho
imho service is better used for accessing and manipulating data that can be used anywhere. controllers, while they could be used a route, are better for displaying data to a template
mattkrea_ joined the channel
darrin joined the channel
TeknoFiend joined the channel
highcup
Grapho: Gotcha. Yeah, the data I want to pass around won't ever be displayed to the user, but will influence my routes. It's almost like a global setting.