Q:

AngularJS: how to open a modal above a view as a response to a hash change (ngView /$routeProvider)

I am using $routeProvider for my routes in my soon-to-be awesome (first) angular app.
However, comming from backbone, I can't seem to figure out how to open a modal as a response to a hash change.
IE:
http://localhost:3000/#/items/1

would open a Boostrap details modal (template + controller) with the item's model.
Can this be accomplished with the $routeProvider approach:
.when('/items/1', {
    templateUrl: 'views/ItemDetails.html',
    controller: 'ItemDetailsCtrl'
  })
...

Help?

A:

You might be a bit confused about how AngularJS works - and that's completely normal especially if you are used to play with jQuery for DOM manipulation.
AngularJS doesn't come with any function out of the box to launch a modal window and I can see you are using Bootstrap for that. 
I would suggest to take a look at the AngularJS official documentation again (http://docs.angularjs.org/) and check the first examples on the homepage to get your head around it. Also make sure to visit Egghead.io (http://egghead.io/) - really good videos tutorials there.
But to give you some help I put together an example here using Bootstrap and AngularJS to launch a modal window as you want.
You can see it working here (http://plnkr.co/edit/fCaNjLwi4RlCw66yKRd7)
Basically the $routeprovider "points" your application to the right view and controller to be used for a particular route. So whatever you want to be loaded (in this case, the modal window) needs to be part of the view.
Take a look at the code below:
<!doctype html>
<html lang="en" ng-app="myApp">
<head>
  <meta charset="UTF-8">
  <title>ItemDetailsCtrl</title>

  <link data-require="bootstrap@3.0.0" data-semver="3.0.0" rel="stylesheet" href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" />

  <script data-require="jquery@2.0.3" data-semver="2.0.3" src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
  <script data-require="bootstrap@3.0.0" data-semver="3.0.0" src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script>

  <script>

  'use strict';

   var myApp = angular.module('myApp', []).config(function($routeProvider){

      $routeProvider.when('/', 
        {
          templateUrl: 'views/template.html', 
          controller: 'ItemDetailsCtrl' 
        });
   });

   myApp.controller('ItemDetailsCtrl', function(){

  });

  </script>

  <script type="text/ng-template" id="views/template.html">

  <!-- Button to trigger modal -->
  <a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a>

  <!-- Modal -->
  <div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
      <h3 id="myModalLabel">Modal header</h3>
    </div>
    <div class="modal-body">
      <p>One fine body…</p>
    </div>
    <div class="modal-footer">
      <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
      <button class="btn btn-primary">Save changes</button>
    </div>
  </div>

  </script>

</head>

<body ng-controller="ItemDetailsCtrl">

  <div ng-view></div>

</body> 
</html>

Hope that helps!

