Cheatography
                https://cheatography.com
            
        
        
    
                   
                            
    
                    AngularUI Router Quick Reference
                    
                 
                    
        
        
            
    
        
                            
        
                
        
            
                                
            
                
                                                
                                
    
    
            UI-Router Directives
        
                        
                                                            
                            | 
                                 ui-sref="state.name({ stateParam: value })"                                                              | 
                         
                                            
                            | 
                                 ui-sref-active="activeClass"                                                                     Applies the class if nearest ui-sref or a descendant state is active 
                                                             | 
                         
                                            
                            | 
                                                                                                     Applies the class if nearest ui-sref state is active 
                                                             | 
                         
                                            
                            | 
                                 ui-view="viewName"                                                              | 
                         
                                            
                            | 
                                 <ui-view autoscroll="condition">                                                                     Scroll into view on load 
                                                             | 
                         
                                                 
                             
    
    
            UI-Router Filters
        
                        
                                                            
                            | 
                                 string | isState                                                                     alias for $state.is('stateName') 
                                                             | 
                         
                                            
                            | 
                                 string | includedByState                                                                     alias for $state.includes('stateName') 
                                                             | 
                         
                                                 
                             
    
    
            UI-Router Events
        
                        
                                                            
                            | 
                                 $stateChangeSuccess                                                                     Fired after completion 
                                                             | 
                         
                                            
                            | 
                                 $stateChangeError                                                                     Fired on state resolution error USEFUL FOR DEBUGGING 
                                                             | 
                         
                                            
                            | 
                                 $stateChangeStart                                                              | 
                         
                                            
                            | 
                                 $stateNotFound                                                              | 
                         
                                            
                            | 
                                 $viewContentLoading                                                              | 
                         
                                            
                            | 
                                 $viewContentLoaded                                                              | 
                         
                                                 
                             
    
    
            UI-Router Services
        
                        
                                                            
                            | 
                                 $state                                                              | 
                         
                                            
                            | 
                                 $stateParams                                                                     contains current url params (tokens) as properties 
                                                             | 
                         
                                            
                            | 
                                 $stateProvider                                                                     config only 
                                                             | 
                         
                                            
                            | 
                                 $urlRouterProvider                                                                     config only 
                                                             | 
                         
                                                 
                             
                             | 
                                                                              | 
                                                        
                                
    
    
            $state Service
        
                        
                                                            
                            | 
                                                                                                     alias for transitionTo() 
                                                             | 
                         
                                            
                            | 
                                                                                                     ‘contact.detail':  go to ‘contact.detail'. ‘^’: go to parent. ‘^.sibling’: go to sibling. ‘.child.grandchild’: go to current state's [grand]child. 
                                                             | 
                         
                                            
                            | 
                                                                                                     Force reload current state tree 
                                                             | 
                         
                                            
                            | 
                                                                                                     Specifies if passed state is currently active (ancestry) 
                                                             | 
                         
                                            
                            | 
                                                                                                     Specifies if passed state is current (exact) 
                                                             | 
                         
                                            
                            | 
                                                                                             | 
                         
                                            
                            | 
                                                                                                     Returns specified state or all states 
                                                             | 
                         
                                            
                            | 
                                                                                                     The current state object 
                                                             | 
                         
                                                 
                            
                             
                             | 
                                                                              | 
                                                        
                                
    
    
            State Definition Object
        
                        
                                                            
                            | 
                                 url {string}                                                                     Url's are appended to parent states. Create tokens using "/:token" or using RegEx  "/{token:[a-zA-Z0-9]}" 
                                                             | 
                         
                                            
                            | 
                                 template {string|function}                                                                     String containing template HTML or injectable function that returns the string value.  (ignored if using views option) 
                                                             | 
                         
                                            
                            | 
                                 templateUrl {string|function}                                                                     String containing path to HTML file or injectable function that returns the string value.  (ignored if using views option) 
                                                             | 
                         
                                            
                            | 
                                 controller {string|function}                                                                     String name of controller or the controller function (ignored if using views option) 
                                                             | 
                         
                                            
                            | 
                                 abstract {boolean[false]}                                                                     If you can $state.go() to this view directly 
                                                             | 
                         
                                            
                            | 
                                 onEnter {function}                                                                     Resolved dependency injectable function. Can't access $scope 
                                                             | 
                         
                                            
                            | 
                                 onExit {function}                                                                     Resolved dependency injectable function. Can't access $scope 
                                                             | 
                         
                                            
                            | 
                                 reloadOnSearch {boolean[true]}                                                                     if false will not retrigger the same state when a query (search) parameter has changed. 
                                                             | 
                         
                                            
                            | 
                                 params {array}                                                                     parameter names or regular expressions when no url is present. 
                                                             | 
                         
                                            
                            | 
                                 views {object}                                                                     controller and templates for specific views 
                                                             | 
                         
                                            
                            | 
                                 data {object}                                                                     stores static configuration data 
                                                             | 
                         
                                            
                            | 
                                 resolve {object}                                                                     Creates injectable resources:  { resourceName: function(dependencies){ return promise | data; }
  
                                                             | 
                         
                                                 
                            
                             
                             | 
                                                            
            
                            
            
            
        
        
        
        
        
            
    
        
          
        
         
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by ProLoser