title: Angular TypeError: name.replace is not a function for ng-style
body: <p>I'm new to angular and keep getting the following error in the console <code>TypeError: name.replace is not a function</code>. I'm not sure what's exactly causing it, but it seems to be caused by the <code>ng-style</code> statement and maybe something to do with the camelCase?</p>
  
  <p>The part I don't understand is why <code>ng-style="isFrontView() || !matches &amp;&amp; {'display': 'none'}"</code> throws the error, but <code>ng-style="!isFrontView() || !matches &amp;&amp; {'display': 'none'}"</code> doesn't throw the error.</p>
  
  <p>In an attempt to remedy the situation I tried removing the camelCase from the function name and went all lowercase. I also attempted to use <code>!!isFrontView()</code>, but neither seemed to remove the error message.</p>
  
  <p>Do anyone know what is the cause of this error message and a potential fix?</p>
  
  <p><img src="https://i.stack.imgur.com/RIsl6.png" alt="Error Message"></p>
  
  <p>HTML Template:</p>
  
  <pre><code>&lt;div class="system-view"&gt;
      &lt;div class="controller-container fill" id="systemView1" ng-style="isFrontView() || !matches &amp;&amp; {'display': 'none'}"&gt;
          &lt;canvas id="canvasLayer-shell" data-layername="front" width="617" height="427"&gt;&lt;/canvas&gt;
          &lt;i ng-if="!matches" class="fa fa-repeat toggle-view" ng-click="changeView()" ng-touch="changeView()"&gt;&lt;/i&gt;
      &lt;/div&gt;
      &lt;div class="controller-container fill" id="systemView2" ng-style="!isFrontView() || !matches &amp;&amp; {'display': 'none'}"&gt;
          &lt;canvas id="canvasLayer-shell" data-layername="back" width="617" height="427"&gt;&lt;/canvas&gt;
          &lt;i ng-if="!matches" class="fa fa-undo toggle-view" ng-click="changeView()" ng-touch="changeView()"&gt;&lt;/i&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Backend Code:</p>
  
  <pre><code>$scope.frontView = true;
  $scope.matches = true;
  
  $scope.isFrontView = function() {
     return $scope.frontView;
  };
  
  $scope.changeView = function() {
      $scope.frontView = !$scope.frontView;
  };
  </code></pre>
  
  <p>P.S. Even with the console error everything still functions normally.</p>