Monaca Onsen UI Discord Chat Github Repo

Background item list not work after update Onsen v1 to v2



  • Hi!
    I am updating an application with Onsen v1 to v2. Before update my app, when click a item on list, the background of this item changed.

    <ons-list-item class="item-res-mon" ng-click="select(monitor)" ng-style="monitor.style" ng-show="monitor.show" ng-repeat="monitor in monitors" tappable>
    	<div class="img-res-monitor">
    		<div class="img-circle" style="background-image: url({{monitor.imagen}})"></div>
    	</div>
    	<div class="text-res-monitor">
    		<div class="nombre-res-monitor">
    			<span>{{monitor.nombre}}</span>
    		</div>
    		<div class="esp-res-monitor">
    			<span>{{monitor.info}}</span>
    		</div>
    	</div>
    </ons-list-item>
    

    monitor.style return {‘background’: ‘none’}; if deselect and {‘background’: ‘white’}; if clicked. In onsen v1 work perfectly but in onsen v2 not work.

    I think the problem is in the transitions. When ng-style tries to put the background, the tappable transition removes it. If I remove the tappable attribute, it does not work either.
    How can I continue using my onsen v1 logic on onsen v2?
    Thanks a lot!!