title: dealing with trailing slashes in angularjs
body: <p>I have a function that looks like this:</p>
  
  <pre><code>   $scope.deleteTodo = function(id) {
          var url = '/musicians/' + id;
          console.log("URL" + url);
          $http.delete(url, { 'id': id})
              .success(function(data) {
                  $scope.todos = data;
                  console.log(data);
              })
              .error(function(data) {
                  console.log('Error: ' + data);
              });
      };
  </code></pre>
  
  <p>If Id is 123, I get <code>/musicians123</code></p>
  
  <p>However, I was expecting <code>/musicians/123</code>. </p>
  
  <p>I straightaway get an error and it does not even print <code>console.log</code> statement. Since it it before $http.delete, I believe it should have been printed but it does not.</p>
  
  <p>I have tried escaping <code>/</code> using <code>\\/</code> but did not help.</p>
  
  <p>Also, I tried to configure with:</p>
  
  <pre><code>.config(['$resourceProvider', function($resourceProvider) {
    // Don't strip trailing slashes from calculated URLs
    $resourceProvider.defaults.stripTrailingSlashes = false;
  }]);
  </code></pre>
  
  <p>Stacktrace:</p>
  
  <pre><code>DELETE http://localhost:3000/musicians55accbce27e2cd2802de4894 404 (Not Found)$get.id @ angular.min.js:100n @ angular.min.js:96l @ angular.min.js:95$get.l.(anonymous function) @ angular.min.js:97$scope.deleteTodo @ VM416 core.js:43w @ angular.min.js:73(anonymous function) @ angular.min.js:145$get.e.$eval @ angular.min.js:89$get.e.$apply @ angular.min.js:89(anonymous function) @ angular.min.js:145x.event.dispatch @ jquery.min.js:5x.event.add.y.handle @ jquery.min.js:5
  VM416 core.js:49 Error: Error: Not Found
      at Layer.handle (C:\Users\dev4\Desktop\Sample\server.js:86:13)
      at trim_prefix (C:\Users\dev4\Desktop\Sample\node_modules\express\lib\router\index.js:226:17)
      at C:\Users\dev4\Desktop\Sample\node_modules\express\lib\router\index.js:198:9
      at Function.proto.process_params (C:\Users\dev4\Desktop\Sample\node_modules\express\lib\router\index.js:251:12)
      at next (C:\Users\dev4\Desktop\Sample\node_modules\express\lib\router\index.js:189:19)
      at next (C:\Users\dev4\Desktop\Sample\node_modules\express\lib\router\index.js:166:38)
      at next (C:\Users\dev4\Desktop\Sample\node_modules\express\lib\router\index.js:166:38)
      at next (C:\Users\dev4\Desktop\Sample\node_modules\express\lib\router\index.js:166:38)
      at next (C:\Users\dev4\Desktop\Sample\node_modules\express\lib\router\index.js:166:38)
      at next (C:\Users\dev4\Desktop\Sample\node_modules\express\lib\router\index.js:166:38)
      at next (C:\Users\dev4\Desktop\Sample\node_modules\express\lib\router\index.js:166:38)
      at next (C:\Users\dev4\Desktop\Sample\node_modules\express\lib\router\index.js:166:38)
      at next (C:\Users\dev4\Desktop\Sample\node_modules\express\lib\router\index.js:166:38)
      at next (C:\Users\dev4\Desktop\Sample\node_modules\express\lib\router\index.js:166:38)
      at next (C:\Users\dev4\Desktop\Sample\node_modules\express\lib\router\index.js:166:38)
      at next (C:\Users\dev4\Desktop\Sample\node_modules\express\lib\router\index.js:166:38
  </code></pre>
  
  <p>But no help. How do I fix this?</p>