angular ng-bind-html and directive within it

I was also facing this problem and after hours searching the internet I read @Chandermani’s comment, which proved to be the solution. You need to call a ‘compile’ directive with this pattern: HTML: <div compile=”details”></div> JS: .directive(‘compile’, [‘$compile’, function ($compile) { return function(scope, element, attrs) { scope.$watch( function(scope) { // watch the ‘compile’ expression for … Read more

Add directives from directive in AngularJS

In cases where you have multiple directives on a single DOM element and where the order in which they’re applied matters, you can use the priority property to order their application. Higher numbers run first. The default priority is 0 if you don’t specify one. EDIT: after the discussion, here’s the complete working solution. The … Read more

Controller not a function, got undefined, while defining controllers globally

With Angular 1.3+ you can no longer use global controller declaration on the global scope (Without explicit registration). You would need to register the controller using module.controller syntax. Example:- angular.module(‘app’, []) .controller(‘ContactController’, [‘$scope’, function ContactController($scope) { $scope.contacts = [“[email protected]”, “[email protected]”]; $scope.add = function() { $scope.contacts.push($scope.newcontact); $scope.newcontact = “”; }; }]); or function ContactController($scope) { $scope.contacts … Read more

What is the difference between ‘@’ and ‘=’ in directive scope in AngularJS?

Why do I have to use “{{title}}” with ‘@‘ and “title” with ‘=‘? @ binds a local/directive scope property to the evaluated value of the DOM attribute. If you use title=title1 or title=”title1″, the value of DOM attribute “title” is simply the string title1. If you use title=”{{title}}”, the value of the DOM attribute “title” … Read more

Is this a “Deferred Antipattern”?

Is this a “Deferred Antipattern”? Yes, it is. ‘Deferred anti-pattern’ happens when a new redundant deferred object is created to be resolved from inside a promise chain. In your case you are using $q to return a promise for something that implicitly returns a promise. You already have a Promise object($http service itself returns a … Read more