fix(toggle): fix ngChange being reported before model changes

Closes #1349, #1741

BREAKING CHANGE:

ion-toggle no longer has an isolate scope.
This will break your toggle only if you were relying upon the toggle
having an isolate scope: if you were referencing `$parent.value` as
the ng-disabled attribute, for example.

Change your code from this:

<ion-toggle ng-disabled="{{$parent.isDisabled}}"></ion-toggle>

To this:

<ion-toggle ng-disabled="{{isDisabled}}"></ion-toggle>
This commit is contained in:
Andrew
2014-07-10 23:48:15 -06:00
parent 3dea57d8fb
commit 537b29d0bb
4 changed files with 40 additions and 35 deletions

View File

@@ -10,16 +10,16 @@ describe('Ionic Toggle', function() {
}));
it('Should load', function() {
var toggleView = el.isolateScope().toggle;
var toggleView = el.scope().toggle;
expect(toggleView).not.toEqual(null);
expect(toggleView.checkbox).not.toEqual(null);
expect(toggleView.handle).not.toEqual(null);
});
it('Should destroy', function() {
var toggleView = el.isolateScope().toggle;
var toggleView = el.scope().toggle;
spyOn(toggleView, 'destroy');
el.isolateScope().$destroy();
el.scope().$destroy();
expect(toggleView.destroy).toHaveBeenCalled();
});
@@ -31,7 +31,7 @@ describe('Ionic Toggle', function() {
// Grab fields
var label = el[0].querySelector('label');
var toggle = el.isolateScope().toggle;
var toggle = el.scope().toggle;
var input = el[0].querySelector('input');
// Not disabled, we can toggle
@@ -59,7 +59,7 @@ describe('Ionic Toggle', function() {
});
it('Should toggle', function() {
var toggle = el.isolateScope().toggle;
var toggle = el.scope().toggle;
var label = el[0].querySelector('label');
expect(toggle.val()).toBe(false);
ionic.trigger('click', {target: label});