I've been working on an application, but it doesn't seem to be functioning correctly. Typically, when we add a value to the scope, I expect it to update in the application. Here is the snippet from index.html:
<body ng-app="starter">
<ion-nav-view>
<ion-view>
<ion-side-menus>
<ion-side-menu-content>
<ion-nav-bar class="top-nav">
</ion-nav-bar>
<ion-content class="body" ng-controller="frontpage">
ss {{njk}} dd
</ion-content>
</ion-side-menu-content>
<ion-side-menu side="left">
</ion-side-menu>
</ion-side-menus>
</ion-view>
</ion-nav-view>
And here is the section from app.js:
var main=angular.module('starter', ['ionic','ngCordova'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
});
main.controller("frontpage", function($scope,$cordovaFile,$ionicPlatform) {
$ionicPlatform.ready(function() {
$scope.njk='sss';
alert($scope.njk);
});
});
The issue seems to be with the $scope.njk variable. I've added it inside the $ionicPlatform.ready block and assigned a value to it, but it's not reflecting in the app. However, the alert box does display the correct value. It's crucial for me to have it within the ready function as cordova.file won't work outside of it. I also tried using $rootScope, but that didn't solve the problem.