title: Use $scope variable in a JavaScript function called from the HTML code - AngularJS
body: <p>I'm using Angular and I'm trying to get $scope to use it in a JavaScript function. Here is an example:</p>
  
  <p>I have an html tag something like this:</p>
  
  <pre><code>&lt;a id="doSomething" onclick="javascript: doSomething(this);"&gt;Do Something&lt;/a&gt;
  &lt;div ng-show="flag"&gt;Click!&lt;/div&gt;
  </code></pre>
  
  <p>and a JavaScript function something like this:</p>
  
  <pre><code>function doSomething(obj) {
      //$scope.flag = true;
      return true;
  }
  </code></pre>
  
  <p>What I want is to use the $scope in this function. I haven't found a way to inject it.
  The thing is that I must use this way to call the function. Do you have any solution to this? I would appreciate it!</p>
  
  <p>Thanks!</p>