FAQ Database Discussion Community


Apply CSS to AngularJS Directive Element Tag

html,css,angularjs,directive
Can I apply a CSS style to an AngularJS directive that has been defined as an element tag? I have the following simple directive: app.directive('popupHelp', function ($window) { return { restrict: 'A', link: function (scope, elem, attrs, ctrl) { elem.bind('click', function (e) { $window.open('http://www.google.com', 'popupHelpWindow', 'width=500,height=500'); console.log("I'm going to get...

AngularJS directive: scope

angularjs,scope,directive
I have the example below: HTML: <body ng-controller="MainCtrl"> <p>Hello {{name}}!</p> <p>Result is {{result}}!</p> <output-content data="name"></output-content> </body> JavaScript: var app = angular.module('plunker', []); app.controller('MainCtrl', function($scope) { $scope.name = 'World'; $scope.result = "no"; $scope.changeLabel = function() { $scope.result = 'yes'; } }); app.directive('outputContent', function() { return { restrict: 'E', replace: true, templateUrl:...

AngularJS - Directive wrapping without losing connection to controller

javascript,angularjs,angularjs-directive,controller,directive
Is there a way for not losing connection to the current controller when you are wrapping data with a directive ? My problem is, that the directive within the wrapped template has no connection to the outside controller any more and so I can not execute the function. Wrapping Directive:...

How can I use special characters in angular directives attributes?

javascript,angularjs,utf-8,special-characters,directive
I would like to use strings including german characters (Ä, Ö, Ü) in attributes of a custom angularJS directive. For example: <my-custom-directive my-label="Lärm" /> Another example is the ui.bootstrap.tabs directive: <tabset> <tab heading="Lärm"> content ... </tab> <tab heading="Second Heading"> content ... </tab> </tabset> This results in a tab with heading...

Compile external HTML which is called by ajax in directive

angularjs,compilation,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...

How to pass object to a directive in angularjs?

javascript,html,angularjs,directive
I have a widget which is attached to a resizable directive, i have a highchart placed inside this directive and want to get this chart resized whenever the container is resized. It works well, but when i am using the same directive for different charts, i need to pass the...

AngularJS - directive with a dynamic array of objects in form

angularjs,directive,ng-repeat,angularjs-ng-model
I'm trying to create a form that has a dynamic set of input boxes. I'm trying to get ng-models to work with array items and I am clearly doing something wrong. My problem seems to be indexing the scope array lineItems in the template. Here is my jsfiddle: http://jsfiddle.net/dk253/9ykuuobq/ Here...

how to simplify the