admin管理员组

文章数量:1334322

I am getting this error in browser:

Error: [$interpolate:interr] Can't interpolate: 
        {{ displayName(stream.StreamName) }}

TypeError: undefined is not a function
.2.25/$interpolate/interr?p0=%0A%20%20%20%20%2…0A%20%20%20%20%20%20&p1=TypeError%3A%20undefined%20is%20not%20a%20function

Code is pretty simple, here is the HTML:

<div class="card" ng-repeat="stream in streams">
  <div class="item item-divider">
    {{ displayName(stream.StreamName) }}
  </div>
  <ion-list>
    <div class="item " ng-repeat="(key, value) in stream">
      {{key}}
      <p>
        {{value}}
      </p>
    </div>
  </ion-list>

And here is the Controller javascript code:

angular.module('starter')
.controller('StreamsCtrl', function ($scope, $timeout) {
  $scope.displayName = function(s) {
    return s.subString(s.lastIndexOf('/')+1)
  }
});

I am getting this error in browser:

Error: [$interpolate:interr] Can't interpolate: 
        {{ displayName(stream.StreamName) }}

TypeError: undefined is not a function
http://errors.angularjs/1.2.25/$interpolate/interr?p0=%0A%20%20%20%20%2…0A%20%20%20%20%20%20&p1=TypeError%3A%20undefined%20is%20not%20a%20function

Code is pretty simple, here is the HTML:

<div class="card" ng-repeat="stream in streams">
  <div class="item item-divider">
    {{ displayName(stream.StreamName) }}
  </div>
  <ion-list>
    <div class="item " ng-repeat="(key, value) in stream">
      {{key}}
      <p>
        {{value}}
      </p>
    </div>
  </ion-list>

And here is the Controller javascript code:

angular.module('starter')
.controller('StreamsCtrl', function ($scope, $timeout) {
  $scope.displayName = function(s) {
    return s.subString(s.lastIndexOf('/')+1)
  }
});
Share Improve this question asked Dec 30, 2014 at 22:48 NiTiNNiTiN 1,0221 gold badge16 silver badges25 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

"can't interpolate" wording overwhelmed me :)

When I tried to console.log(), it wouldn't work... and problem was, I misspelled javascript subString(). Its not capitalized, its substring().

Only reason to write this question and answer so others know that when you get 'interpolation error', it could be as simple as javascript typo.

本文标签: javascriptAngularJS can39t interpolate errorStack Overflow