title: Can you pass parameters to an AngularJS controller on creation?
body: <p>I have a controller responsible for communicating with an API to update properties of a user, name, email, etc. Each user has an <code>'id'</code> which is passed from the server when the profile page is viewed. </p>
  
  <p>I would like to pass this value to the AngularJS controller so it knows what the API entry point is for the current user. I've tried passing the value in <code>ng-controller</code>. For example:</p>
  
  <pre><code>function UserCtrl(id, $scope, $filter) {
  
  $scope.connection = $resource('api.com/user/' + id)
  </code></pre>
  
  <p>and in the HTML</p>
  
  <pre><code>&lt;body ng-controller="UserCtrl({% id %})"&gt;
  </code></pre>
  
  <p>where <code>{% id %}</code> print the id sent from the server. but I get errors. </p>
  
  <p>What is the correct way to pass a value into a controller on its creation?</p>