Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 21:13
    greenkeeper[bot] labeled #5378
  • 21:12
    greenkeeper[bot] opened #5378
  • 21:12

    greenkeeper[bot] on can-simple-map-4.3.3

    fix(package): update can-simple… (compare)

  • 20:19
    greenkeeper[bot] labeled #5377
  • 20:19
    greenkeeper[bot] opened #5377
  • 20:19

    greenkeeper[bot] on @feathersjs

    chore(package): update @feather… (compare)

  • 20:18
    greenkeeper[bot] labeled #5376
  • 20:18
    greenkeeper[bot] opened #5376
  • 20:18

    greenkeeper[bot] on @feathersjs

    chore(package): update @feather… (compare)

  • 14:43
    greenkeeper[bot] closed #5373
  • 14:43

    greenkeeper[bot] on can-deep-observable-1.0.1

    (compare)

  • 14:42

    m-mujica on update-deep-observable

    (compare)

  • 14:42

    m-mujica on master

    Update can-deep-observable to l… Merge pull request #5374 from c… (compare)

  • 14:42
    m-mujica closed #5374
  • 14:42
    m-mujica closed #5365
  • 14:09
    f-ricci starred canjs/canjs
  • 13:55
    greenkeeper[bot] commented #5375
  • 13:55

    greenkeeper[bot] on core-js-3.3.2

    chore(package): update core-js … (compare)

  • 10:51
    m-mujica review_requested #5374
  • 07:43
    rjgotten commented #5358
Christopher Oliphant
@RALifeCoach
It is contained within another component and set by the parent when the data changes.
In debug, when I examine the component, I can see the value in the attribute has changed, but I don’t see the change within the component.
    var Model = can.Map.extend({
        define: {
            hasMedia: {
                type: 'boolean',
                set: function () {
                    debugger;
                }
            }
        }
    });
    can.Component.extend({
        tag: 'feature-icon',
        template: can.view('/modules/components/feature-icon/feature-icon.stache'),
        viewModel: Model
    });
Christopher Oliphant
@RALifeCoach
Still no luck
BTW, I included can/stache/system, but <can-import> didn’t work
Julian
@pYr0x
how do you mean , inclueded can/stache/system?
how do you use canjs?
AMD?
global?
Christopher Oliphant
@RALifeCoach
global
Julian
@pYr0x
and how could you include can/stache/system ?
Christopher Oliphant
@RALifeCoach
so when I built the custom file, I included can/stache/system
Mohamed Cherif Bouchelaghem
@cherifGsoul
I think a dependency manager (steal,requirejs,webpack) is required to use can/stache/system
Julian
@pYr0x
ok
Christopher Oliphant
@RALifeCoach
@cherifGsoul any suggestions on my delema
Mohamed Cherif Bouchelaghem
@cherifGsoul
@RALifeCoach I didnt follow from the bginning
:/
Christopher Oliphant
@RALifeCoach

okay - I have a component:

<feature-icon type="article" types="articles" 
                                  isActive="{{isActive}}" 
                                  hasMedia="{{hasMediaContent('articles')}}" 
                                  profilesURL="options.profilesURL"></feature-icon>

with the component defined as:

    var Model = can.Map.extend({
        define: {
            hasMedia: {
                type: 'boolean',
                set: function () {
                    debugger;
                }
            }
        }
    });
    can.Component.extend({
        tag: 'feature-icon',
        template: can.view('/modules/components/feature-icon/feature-icon.stache'),
        viewModel: Model
    });

The debugger is never called

I know the value in hasMedia is initially set to false and is later set to true
Mohamed Cherif Bouchelaghem
@cherifGsoul
use has-mediaas attribute in the component
Christopher Oliphant
@RALifeCoach
The attribute value never seems to get changed in the viewModel
Mohamed Cherif Bouchelaghem
@cherifGsoul
change it to what I sugget
<feature-icon type="article" types="articles" 
                                  is-active="{{isActive}}" 
                                  has-media="{{hasMediaContent('articles')}}" 
                                  profiles-URL="options.profilesURL"></feature-icon>
Christopher Oliphant
@RALifeCoach
Thanks - that was all it took
Mohamed Cherif Bouchelaghem
@cherifGsoul
works?
Christopher Oliphant
@RALifeCoach
It is better, not sure if all is working yet
Julian
@pYr0x
@cherifGsoul great job :)
Veni vidi vici
:clap:
Mohamed Cherif Bouchelaghem
@cherifGsoul
thank you I dont know if those points exist in the docs
Christopher Oliphant
@RALifeCoach
Yes - it is working now. the attribute is has-media, but when I use it in the stache file it is hasMedia. A bit confusing.
Mohamed Cherif Bouchelaghem
@cherifGsoul
@RALifeCoach it'scanjs recommandation properties camel cased like hasMediaand template attributes hypenated like has-media
dont be confused bro :)
Christopher Oliphant
@RALifeCoach
I am easily confused. (And I am having a lot of fun.)
I just hope I am not being too much of a bother. I really appreciate all the assistance I am getting from folks here.
Matthew Phillips
@matthewp
Every time I come here and see 50+ recent messages i'm terrified but mostly excited :)
CanJS is blowing up!
Mohamed Cherif Bouchelaghem
@cherifGsoul
@matthewp we are the night watch :D
but it's the efternoon here
Matthew Phillips
@matthewp
hehe
Christopher Oliphant
@RALifeCoach
Me again. I am trying to access the view model from an event.
the view model has a function, the events tries:
this.viewModel.vmFunction();
The message is vmFunction is not a function
If I break at that statement and add a watch, this.viewModel.vmFunction returns undefined
Mohamed Cherif Bouchelaghem
@cherifGsoul
@RALifeCoach maybe full code (component, template) can help to have a quick answer
Christopher Oliphant
@RALifeCoach
Component:
    can.Component.extend({
        tag: 'player-row',
        template: can.view('/modules/components/player-row/player-row.stache'),
        helpers: helpers,
        events: {
            '.add-to-favorite click': function () {
                this.viewModel.callParent('onPinPlayer');
            }
        }
Map:
    var Map = MapBase.extend({
        define: {
            options: {
                Type: OptionsMap
            },
            pid: {
                type: 'string'
            },
            player: {
                Type: PlayerMap
            },
        },

        callParent: function (method) {
            this.attr(method)();
        },
Mohamed Cherif Bouchelaghem
@cherifGsoul
@RALifeCoach you dont have a viewModel in your component
Christopher Oliphant
@RALifeCoach
Inserted via:
            this.playerRowMap = new Map(data);
            var template = can.stache('<player-row id="player-row-' + this.pid + '"></player-row>');
            this.container.append(template(this.playerRowMap));