These are chat archives for canjs/canjs

1st
Apr 2015
Sami Pietilä
@smiper
Apr 01 2015 07:16
@marshallswain thanks, but the component/element is only inserted to the document once and its content/attributes change. Is listening the change of the whole content somehow not a recommended thing to do? I'm trying to find the most "correct" way to do this, but I think I'll solve this with a custom event of some sort.
Marshall Thompson
@marshallswain
Apr 01 2015 13:33
It's typical in my projects for the content to be attached to the scope (viewModel) and changes to content will change the viewModel. You may have a use case where that won't work, but I normally try to watch for changes on the viewModel since it is a can.Map.
if you do need to listen to Dom changes, I would think that the inserted event is the place to put your code. If you are using nested Components it might not be that effective.
Justin Meyer
@justinbmeyer
Apr 01 2015 15:38
@smiper yeah, you can use a MutationObserver
alternatively, you can use can-inserted={parentMethod} can-removed="{parentMethod}`
Justin Meyer
@justinbmeyer
Apr 01 2015 15:53
@akagomez asks:
Would wrapping can-click="scopeFn" in an {{#if}} work? Like this... {{#if blah}}can-click="scopeFn"{{/if}}
yes ... it does work
Gerard Finnerty
@halcyonandon
Apr 01 2015 22:48
Hi, I'm trying to use can.mustache.helpers.is but I only ever reach the else condition... does this need to be included as a module dependency for the component in order to work if using amd?
{{#is somethingInScope.theAttr "theStringValue"}} Show ME! {{/if}}
Gerard Finnerty
@halcyonandon
Apr 01 2015 23:34
ah, ok, it was introduced later than the version i was using....