I'm an Angularjs newbie and I'm trying to create a settings panel in Ionic Framework. I want to save the setting into localStorage, but for now I'm just logging the scope change. But it doesn't work and I'm getting crazy.
My HTML is
<ion-view title="Settings">
<ion-content class="has-header">
<ul class="list" ng-controller="settingsController as setting">
<ion-toggle ng-model="setting.examType.checked"
ng-change="setting.examTypeChange()"
ng-true-value="oltre"
ng-false-value="entro">
Exam Type
</ion-toggle>
</ul>
</ion-content>
</ion-view>
and my controller is
class Settings extends Controller
constructor: ($localStorage) ->
@examType = { checked: 'entro' }
@examTypeChange = () ->
console.log('exam type change', @examType.checked)
return
I'm using ng-classify, compiled in javascript the result is:
function() { var Settings;
Settings = (function() {
function Settings($localStorage) {
this.examType = {
checked: 'entro'
};
this.examTypeChange = function() {
console.log('exam type change', this.examType.checked);
};
}
return Settings;
}
Log doesn't work: when I switch toggle nothing happen. Any idea?