From b93aae4940fc3f774f05976d68af52e155f923f6 Mon Sep 17 00:00:00 2001 From: jbavari Date: Fri, 16 Oct 2015 13:19:42 -0600 Subject: [PATCH] Fix(segment): Change for loops to be forEach --- ionic/components/segment/segment.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/ionic/components/segment/segment.ts b/ionic/components/segment/segment.ts index 4f53673b17..d3502a6862 100644 --- a/ionic/components/segment/segment.ts +++ b/ionic/components/segment/segment.ts @@ -80,13 +80,11 @@ export class Segment extends Ion { if (this.buttons.length == 0) { return; } - //for(let button of this.buttons) { - for(var i = 0, j = this.buttons.length; i < j; i++) { - var button = this.buttons[i]; + this.buttons.forEach(function(button) { if(button.value === value) { button.isActive = true; } - } + }); } /** @@ -94,11 +92,9 @@ export class Segment extends Ion { * @param {SegmentButton} segmentButton The button to select. */ selected(segmentButton) { - //for(let button of this.buttons) { - for(var i = 0, j = this.buttons.length; i < j; i++) { - let button = this.buttons[i]; + this.buttons.forEach(function(button) { button.isActive = false; - } + }); segmentButton.isActive = true; //this.onChange();