Android 类固醇+;Angular1.3.15 iOS(AppGyver)

Android 类固醇+;Angular1.3.15 iOS(AppGyver),android,ios,angularjs,steroids,appgyver,Android,Ios,Angularjs,Steroids,Appgyver,我正在尝试在类固醇+Angular1.3.15(AppGyver)混合应用程序中实现字体缩放。我决定使用$localStorage来存储当前的字体大小。这一切在android设备上都很好,但在iOS上却不行。。实际上,在iOS中,它适用于新打开的网络视图,但不适用于已经显示的视图 字体缩放链接: <a class="font-size font-small" data-remote="true" ng-class="{current: fontSize == 'rem-base-small

我正在尝试在类固醇+Angular1.3.15(AppGyver)混合应用程序中实现字体缩放。我决定使用
$localStorage
来存储当前的字体大小。这一切在android设备上都很好,但在iOS上却不行。。实际上,在iOS中,它适用于新打开的
网络视图
,但不适用于已经显示的视图

字体缩放链接:

<a class="font-size font-small" data-remote="true" ng-class="{current: fontSize == 'rem-base-small'}" ng-click="setFontSize('rem-base-small')">A</a>
<a class="font-size font-medium" data-remote="true" ng-class="{current: fontSize == 'rem-base-medium'}" ng-click="setFontSize('rem-base-medium')">A</a>
<a class="font-size font-large" data-remote="true" ng-class="{current: fontSize == 'rem-base-large'}" ng-click="setFontSize('rem-base-large')">A</a>    
我使用
标记上的
myfontsize
指令来更新UI。我的指令是这样的:

var sharedStuff = angular.module('sharedStuff', ['ngStorage'])

  sharedStuff.directive('myfontsize', function($localStorage) {
    function link(scope, element, attrs) {
        var format,
            timeoutId;

        function updateClass() {
          element.removeClass('rem-base-large')
          element.removeClass('rem-base-medium')
          element.removeClass('rem-base-small')

          $localStorage.fontSize = $localStorage.fontSize || "rem-base-medium"
          element.addClass($localStorage.fontSize)
        }

        scope.$watch(attrs.myCurrentTime, function(value) {
          format = value;
          updateClass();
        });

        element.on('$destroy', function() {
          clearInterval(timeoutId);
        });

        // start the UI update process; save the timeoutId for canceling
        timeoutId = setInterval(function() {
          updateClass(); // update DOM
        }, 1000);
      }

      return {
        link: link
      };
  })

如果有人能解释为什么它能在android上运行,但在iOS上却不能,我将不胜感激。或者,如果您有更好的解决方案来实现我的目标,并且不介意共享,请这样做:)

当您说“它适用于新打开的
网络视图,但不适用于已显示的视图”时,您的意思是已经显示的视图已预加载,并且不适用于这些视图吗?您也可以尝试提问。每次在侧边菜单中单击链接时,“$scope.switchPage=function(item){webView=new steroids.views.webView(item.url);steroids.layers.push(webView);steroids.drawers.hide()};”字体的缩放正确,因此,是的,它在iOS预加载的视图上不起作用
var sharedStuff = angular.module('sharedStuff', ['ngStorage'])

  sharedStuff.directive('myfontsize', function($localStorage) {
    function link(scope, element, attrs) {
        var format,
            timeoutId;

        function updateClass() {
          element.removeClass('rem-base-large')
          element.removeClass('rem-base-medium')
          element.removeClass('rem-base-small')

          $localStorage.fontSize = $localStorage.fontSize || "rem-base-medium"
          element.addClass($localStorage.fontSize)
        }

        scope.$watch(attrs.myCurrentTime, function(value) {
          format = value;
          updateClass();
        });

        element.on('$destroy', function() {
          clearInterval(timeoutId);
        });

        // start the UI update process; save the timeoutId for canceling
        timeoutId = setInterval(function() {
          updateClass(); // update DOM
        }, 1000);
      }

      return {
        link: link
      };
  })