CRM-14798 - crmUi - Add "goto()" helper function
authorTim Otten <totten@civicrm.org>
Tue, 1 Jul 2014 00:19:20 +0000 (17:19 -0700)
committerTim Otten <totten@civicrm.org>
Tue, 1 Jul 2014 00:19:20 +0000 (17:19 -0700)
Example: <button ng-click="goto('home')">Go home!</button>

This allows us to use buttons instead of <A HREF>'s -- which makes it easier
to maintain consistent styling in a button bar.

js/angular-crm-ui.js

index 021550d5dac3b2cf7f140489d33b2f5ba7a8161b..52c02a2739d3daab266396f85ab126596ec862e1 100644 (file)
         }
       };
     })
+    .run(function($rootScope, $location) {
+      /// Example: <button ng-click="goto('home')">Go home!</button>
+      $rootScope.goto = function(path) {
+        $location.path(path);
+      };
+    })
   ;
 
 })(angular, CRM.$, CRM._);
\ No newline at end of file