FAQ Database Discussion Community


Angular Directive: bind 'mouseover' event to an element

javascript,angularjs,events,bind,directive
In my controller, I have the following array of users, which will be displayed by iteration in the partial html template in controller: vm.users = [ {"username": "johnDoe", "address": "Saltlake City, UT", "age": 34}, {"username": "janeDoe", "address": "Denver, CO", "age": 33}, {"username": "patrickDoe", "address": "San Francisco, CA", "age": 35} ];...

AngularJS $scope not accesible in template

javascript,angularjs,templates,scope,directive
As the title summaries pretty well, I've got a template where it seems impossible to access my $scope. To write some more information. The template is rendered into a directive from another template like this: <site-overview class="site-overview float_left" ng-repeat="site in currentEngine.data.sites" site='site' provider='currentEngine' style="background-color: {{currentEngine.data.skin.skin_color_2}}"> </site-overview> These 'site-overview' templates are...

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...

Corrent means of coding a directive in Angular

angularjs,directive
I have some code here <div ng-repeat="student in students" class="student"> <div class="col-md-2"> <div class="row placeholder"> <img data-src="holder.js/200x200/auto/sky" class="img-responsive profile" alt="200x200" src="#" data-holder-rendered="true"> </div> </div> <div class="col-md-10" style="padding: 17px 40px;"> <div class="row"><h1 class="name"><a href="/database/profile.php?id=2015552117"><span>{{ student.FirstName }}</span> {{ student.LastName }} , {{...

Angular Directive won't show up

javascript,html,angularjs,angularjs-directive,directive
While studying about directives, I keep getting something basic wrong because I simply cannot make one work in order to import something from another html file. HTML (index.html) <!DOCTYPE html> <html ng-app="myapp"> <head><script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script><script type="text/javascript" src="app.js"></script></head> <body> <hello-world></hello-world> </body></html> HTML (ssth.html - in the same directory...

dynamically add ui-sref to an element

angularjs,directive
I have the following directive .directive('famAction', function () { var directive = { restrict: 'A', scope: {action: '='}, link: link }; function link(scope, element) { if (scope.action.hasOwnProperty('state')) { element.attr('ui-sref', scope.action.state); } if (scope.action.hasOwnProperty('func')) { element.bind('click', scope.action.func); } } return directive; }) The problem is that, when adding the ui-sref attribute,...

C/C++ language file generation with Apache Velocity

java,c++,apache,velocity,directive
I need to generate a C/C++ source file and I thought to use velocity because I already have the sample output file and only need to change some dynamic parts from the sample. The problem is that the template file contains a lot of #define's and #include's. Is there a...

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...

Directive Angularjs, $watch and HTML Element

html,angularjs,element,directive,watch
I have a question. I coded a HTML page with an angularjs directive this is my code <menufileupload visible="rightVisible" alignment="right"> <input type="text" ng-model='expr'/> <!--Other stuff--> </menufileupload> I'm trying to use a $watch to check any change in the text field $scope.$watch(...) only worked when the text field is out of...

AngularJs animate background color / colour

javascript,angularjs,colors,jquery-animate,directive
I have been trying to Dynamically Animate a background between 2 colours on click using AngularJs Directives and Controllers (with no success so far). Does anyone know how to do this? I have been trying to store the currCol (stored as an array var pushed into ng-class), but then I...

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

angularjs,directive
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 =...

Angularjs directive call controller function

javascript,angularjs,controller,directive
i have a directive which renders a long list. The Rendering works pretty fine and fast, now i would like to call a function on the Controller with Parameters. How can i achieve this? Here is my directive: .directive("slheats", function () { return { restrict: "A", scope: { slheats: "=",...

Angular not binding ng-click

javascript,angularjs,directive
I am building an export function for my app in angular. I need to have clickable buttons that would call an export function in the scope. I tried to use ng-click="myFunction()", but the export is not called … Here is my jade template ul.dropdown-menu(role='menu' aria-labelledby='dLabel') li a(export-content-as, export-type='markdown', export-content='properties.quill.getHTML', href='',...

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 controller required by directive can not be found in transclude content

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

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

angularjs,scope,require,directive
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?...

AngularJS Passing changing values from Controller to a Directive Controller

javascript,angularjs,controller,directive
I'm pretty new with angular and I've read a lot of threads here and googled this topic but I cannot get a clear answer. What I'm trying to do is pass a value that is not set until the user makes a selection, at which point my controller will make...

how to simplify the