angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

(iOS 8 GM iPhone5C) TypeError: Attempted to assign to readonly property

Open HAKASHUN opened this issue 12 years ago • 163 comments

I am using on iOS 8 GM(iPhone5C). With this device, I am getting this error in this line(https://github.com/angular/angular.js/blob/master/src/ng/rootScope.js#L216) But on iOS 8 GM(iPhone5S) and iOS 7.x (iPhone5C, iPhone5S), this error does not occur.

To resolve this error, I rewrote the code as follows:

$new: function(isolate) {
        var child;

        if (isolate) {
          child = new Scope();
          child.$root = this.$root;
          // ensure that there is just one async queue per $rootScope and its children
          child.$$asyncQueue = this.$$asyncQueue;
          child.$$postDigestQueue = this.$$postDigestQueue;
        } else {
          // Only create a child scope class if somebody asks for one,
          // but cache it to allow the VM to optimize lookups.
          if (!this.$$ChildScope) {
            this.$$ChildScope = function ChildScope() {
              this['$$watchers'] = this['$$nextSibling'] =
                  this['$$childHead'] = this['$$childTail'] = null;
              this['$$listeners'] = {};
              this['$$listenerCount'] = {};
              this['$id'] = nextUid();
              this['$$ChildScope'] = null;
            };
            this.$$ChildScope.prototype = this;
          }
          child = new this.$$ChildScope();
        }
        child['this'] = child;
        child['$parent'] = this;
        child['$$prevSibling'] = this.$$childTail;
        if (this.$$childHead) {
          this.$$childTail.$$nextSibling = child;
          this.$$childTail = child;
        } else {
          this.$$childHead = this.$$childTail = child;
        }
        return child;
      },

The situation has improved, but I do not understand the reason...

HAKASHUN avatar Sep 17 '14 13:09 HAKASHUN

I have this issue using Angular 2 (with Ionic 2) in the iPhone 6s / iOS 9.2 simulator. The message is "Exception: TypeError: Attempted to assign to readonly property" I've tried the @jacksonrayhamilton webkit-assign solution, but this does not seem to work with Angular 2 (I've tried in the final app.bundle.js file).

Someone have an ideia how to fix this problem?

Thanks!

TiagoSilvaPereira avatar Dec 15 '16 17:12 TiagoSilvaPereira

@TiagoSilvaPereira Please open an issue about this on the https://github.com/angular/angular repo. This repo here is only for the 1.x branch

Narretz avatar Dec 15 '16 22:12 Narretz

Thanks @Narretsz, i've solved this problem removing all "use strinct" from my code.

TiagoSilvaPereira avatar Dec 16 '16 11:12 TiagoSilvaPereira