UI-router interfers with $httpbackend unit test, angular js

Take this gist https://gist.github.com/wilsonwc/8358542 angular.module(‘stateMock’,[]); angular.module(‘stateMock’).service(“$state”, function($q){ this.expectedTransitions = []; this.transitionTo = function(stateName){ if(this.expectedTransitions.length > 0){ var expectedState = this.expectedTransitions.shift(); if(expectedState !== stateName){ throw Error(“Expected transition to state: ” + expectedState + ” but transitioned to ” + stateName ); } }else{ throw Error(“No more transitions were expected! Tried to transition to “+ stateName ); … Read more

How do I create an AngularJS UI bootstrap popover with HTML content?

UPDATE: As can been seen in this, you should now be able to do this without overriding the default template. ORIGINAL: As of angular 1.2+ ng-bind-html-unsafe has been removed. You should be using the $sce service Reference. Here is a filter for creating trusted HTML. MyApp.filter(‘unsafe’, [‘$sce’, function ($sce) { return function (val) { return … Read more

angular ui-router: get $state info of toState in resolve

Update for Ui-Router 1.x $provide.decorator(‘$state’, ($delegate, $transitions) => { $transitions.onStart({}, (trans) => { $delegate.toParams = trans.params() $delegate.next = trans.to().name }) return $delegate }) Ui-Router 0.x You can always decorate $state with next and toParams properties: angular.config(function($provide) { $provide.decorator(‘$state’, function($delegate, $rootScope) { $rootScope.$on(‘$stateChangeStart’, function(event, state, params) { $delegate.next = state; $delegate.toParams = params; }); return $delegate; … Read more

Angular-UI typeahead: show label but bind to value only

It’s not ideal, but the typeahead-input-formatter attribute provides a work-around until a fix can be provided. (Plunker from github thread). HTML: <input type=”text” ng-model=”myModel” typeahead=”o.value as o.text for o in options | filter:$viewValue | limitTo:5″ typeahead-editable=”false” typeahead-input-formatter=”formatLabel($model)” /> AngularJs controller function: $scope.formatLabel = function(model) { for (var i=0; i< $scope.options.length; i++) { if (model === … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)