title: 'indexOf' is undefined?
body: <p>I always get that error.   So I am pretty sure, there is something wrong with my "$scope.permissionExists = function ()"</p>
  
  <p>Any ideas?  If I missed posting relevant code- please tell me so</p>
  
  <pre><code>&gt; TypeError: Cannot read property 'indexOf' of undefined
  &gt;     at Scope.$scope.permissionExists(http://0.0.0.0:9000/scripts/controllers/signature.js:64:31)
  &gt;     at Object.get (http://0.0.0.0:9000/bower_components/angular/angular.js:11064:21)
  &gt;     at Scope.$digest (http://0.0.0.0:9000/bower_components/angular/angular.js:12775:40)
  &gt;     at Scope.$apply (http://0.0.0.0:9000/bower_components/angular/angular.js:13050:24)
  &gt;     at done (http://0.0.0.0:9000/bower_components/angular/angular.js:8525:45)
  &gt;     at completeRequest (http://0.0.0.0:9000/bower_components/angular/angular.js:8739:7)
  &gt;     at XMLHttpRequest.xhr.onreadystatechange (http://0.0.0.0:9000/bower_components/angular/angular.js:8678:11)
  </code></pre>
  
  <p>here is my code:  <strong>JS</strong></p>
  
  <pre><code>$scope.data = {
            newCustomerSig: null,
            newAccountSig: null,
            user: null,
            account: null,
            permissions: null,
            maxSms: 1
          };
  ....
  var getAccountPermission = function () {
            // check only when authenticated (or refresh possible)
            AccountPermissions.one().getList().then(
                function (resultOk) {
                  var permission = resultOk.data;
                  $log.d("AccountPermissions ok: ", resultOk);
                  $scope.data.permissions = permission;
                },
                function (resultError) {
                  $log.d("Accountinfo error: ", resultError);
                  ErrorService.showApiError(resultError);
                },
                function (resultNotify) {
                  $log.d("Accountinfo notify:", resultNotify);
                }
            );
          };
  
          $scope.permissionExists = function () {
            if (data.permissions.indexOf("sign_change_global") &gt; -1) {
              //In the array!
              return true;
            } else {
              return false;
              //Not in the array
            }
          }; 
  ....
  </code></pre>
  
  <p><em>"sign_change_global" &lt; is a value in the array</em></p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>....
  &lt;form name="formSignature" class=""&gt;
      &lt;div&gt;
        &lt;i&gt; Persönliche Signatur &lt;/i&gt;&lt;br/&gt;
        &lt;textarea id="persSignatur" name="persSignatur"
                  rows="5" cols="40"
                  use-sms-counter="data.smsCounter"
                  ng-model="data.newAccountSig"
                  ng-trim="false"
                  placeholder="{{data.user.signature}}"&gt;
        &lt;/textarea&gt;
        &lt;div&gt;
          {{data.newAccountSignewAccountSig}}
          {{data.smsCounter.textLength}}
          {{data.smsCounter.isUcs2}}
          &lt;div class="amount"
               data-sms-counter="data.smsCounter"
               data-sms-counter-content-list="[data.newAccountSig]"
               data-max-messages="1"&gt;
          &lt;/div&gt;
          {{data.smsCounter}}
  
        &lt;/div&gt;
  
      &lt;/div&gt;
  ....
  </code></pre>