FAQ Database Discussion Community

How to correctly implement in AngularJs: Custom directive reuse several times in single page

I created a custom directive that has event handler on it and use it 3 times. <div sl-entity-browser btn_label="Browse supplier" handler="supplier_selection_handler(entity)" /> <div sl-entity-browser btn_label="Browse checker" handler="checker_selection_handler(entity)" /> <div sl-entity-browser btn_label="Browse approving officer" handler="approvar_selection_handler(entity)" /> In my controller: $scope.supplier_selection_handler = function(entity){ $scope.selectedSupplier = entity; } $scope.checker_selection_handler =...

ng-repeat not working within directive

I've created an Angular wrapper for drop.js which is a javascript library for popups. All works great within the drop directive including normal Angular bindings except when using ng-repeat. Here is a screenshot, notice the content of the popup has a value that is bound to the controller but the...

Angularjs controller required by directive can not be found in transclude content

Recently I use angular to develop a directive, there is an directive which like ng-repeat to generate some records, I used transclude to implement it. but it raise an error that "Controller 'aArea', required by directive 'bSpan', can't be found!". 1. ModuleA code var moduleA = angular.module("moduleA", []); moduleA.directive("aArea", function...

Passing params to nested directives with isolated scope

I have an object data in the MainCtrl. This object is used to pass data to directives first-directive and second-directive. Two-data binding is neccesary in both cases. For first-directive, I pass the complete object data but for second-directive I want to pass numbers object (scope.numbers = scope.dataFirst.numbers). The problem: When...

Compile external HTML which is called by ajax in directive

How to compile external HTML file ? I am loading a external HTML file via ajax based on the browser request in directive so is there any way to compile that file so that it can be used in directive? corpo.directive('corpInbox', function(companyFactory, $templateRequest, $compile) { var directive = {}; directive.restrict...

Do directives that share a required ^parent share parent's $scope?

I'm having an issue where I'm using require in both myDirectiveChild1 -- C1 myDirectiveChild2 -- C1 The children's directive require: ^myDirectiveParent -- P P defines $scope.myVar but C1 and C2 seem to be over-writing the value of parent P's $scope.myVar instead of each having their own copy. Is that normal?...

how to simplify the