Tagged Questions
-1
votes
0answers
20 views
cannot create ng-model dynamically inside a Directive
I am not able to bind the ng-model to the directive dynamically from the given JSON and how to attain it
angular.module('traform.directs', [])
.directive('myLabel', function() {
return {
...
1
vote
2answers
28 views
Incorrect date countdown
I'm using the Countdownjs to insert a count in my project but it is returning the wrong day.
I'm using AngularJS, here's the directive I created for the count:
.directive('tempoPercorrido', function($...
0
votes
1answer
16 views
Pass argument between parent and child directives
I have parent directive for navigation menu and child directives for menu links. Something like this:
<menu>
<menu-link />
<menu-link />
</menu>
In menu directive I use ...
0
votes
0answers
21 views
Accessing functions from parent scope in a template
I am trying to access a function from a parent scope, and even when looking at quite a few posts about this, i can't seem to find what i'm doing wrong. First off, i have a page where i'm calling the ...
0
votes
0answers
20 views
Detect height change (not resize) in AngularJs directive
First of all, I know there are ways to detect when the screen size change by using:
angular.element($window).on('resize', function() {...
But in my case what happens is a change in the document ...
0
votes
0answers
22 views
how to add a fonticons in breadcrumb with routing
i have an angular base dashboard application ,in the application dashboard page icon ,when i click the particular icon ,the icon should be redirected to the routing page with menu breadcrumb with ...
0
votes
1answer
19 views
how to change date add hours in date angularjs
i have below code i want to show date according to hours how to add 48 hours in my current date please help me in this i am new in angularjs.
"startjob_datetime" : ISODate("2017-03-13T14:21:12.231Z"),...
0
votes
2answers
16 views
AngularJS: Property 'ngEnter' does not exist on type 'IAttributes'
I'm using Typescript and migrating the DefinitelyTyped definitions for angular from 1.3 to 1.6.2 leads to the following error in my MainModule.ts:
Error:(14, 43) TS2339:Property 'ngEnter' does not ...
-2
votes
1answer
24 views
Implement functions in link or pass $scope to function outside link
My questions is what is best practice + more efficient?
Implementing functions that use $scope inside the Link function, or implemet it outside and pass $scope to it?
angular.module('exampleModule', ...
1
vote
0answers
21 views
Get element's ng-model value in directive
This is a fictional example, I have a huge template with multiple forms and I want to mark the sections which have touched inputs.
<section>
<form my-directive name="user">
<...
0
votes
1answer
12 views
When unit testing a directive how to pass its controller
I am new to AngularJS and its unit test. Currently I am trying to test a directive with its controller in the template file:
It's template:
<div ng-controller = "SomeController" >
<select ...
0
votes
1answer
30 views
Angularjs DELETE <div> when I press the delete keyboard
I created a new directive to delete a when the user press the delt keyboard but it is not working.I used the angularjs directive: ng-keypress
the directive: keyboard.js
yemp.planner.app ....
0
votes
1answer
46 views
Wrong function called in AngularJS directive
I have two similar directives, where I want to run validators for specific files (it isn't the best practice, I know, since it is not based on DRY principle. But I am just learning AngularJS).
module....
0
votes
0answers
25 views
How to display a font-icons instead of image in Uirouter state and uibreadcrumbs
Note: below code is working fine with images.
Need to know how to implement for font-icons,
when I have to click the product menu, the page will redirect to the product page, product page menu will ...
1
vote
1answer
42 views
how to set $compile code in html
I compile a string but it's not reflect on dom like.
I have some string like :
result = '<tr ng-click="someFun()" rowid="hh_'+gameId+'" id="hh_'+gameId+'" ng-class="game.currVideoReplay[' + ...
0
votes
1answer
27 views
Event emitter callback in angularjs
I'm new to angularjs directive. Currently, I'm creating a sidebar directive:
'use strict';
angular.module('sidebar', ['ngRoute'])
.directive('sidebar', function () {
return {
...
1
vote
0answers
25 views
AngularJS transcluded scope form element
I am having an issue in Angular being able to get a reference to a form element from sibling transclude elements.
HTML
<div modal-panel>
<modal-content>
<form name="myForm"...
2
votes
2answers
44 views
ng repeat on a array to filter a key on another object to get the associated value and use watch on that value
Let say i have a object called,
scope.rec = {a: 2, b: 3, name: a,b};
And i split the "name" key like scope.x = scope.rec.name.split(","); then scope.x will become an array.
Now i need to iterate ...
0
votes
0answers
17 views
AngularJS Three Order of rowspan dynamically
I am a beginner in AngularJS. I need to do Three order of rowspan dynamically. I have referred the below URL:
AngularJS Third Order Nested Table Structure
But still it is very difficult to make it ...
1
vote
3answers
40 views
AngularJS directive not called
Hi guys I've created 2 directives, one for each object that I have, one is adminGroups, the other is adminProfiles. I have this problem, the 2nd directive is not called at all. This is the controller:
...
0
votes
1answer
30 views
Tri-state md-checkbox with angular materials
I'm working with Angular material 1.0.5 and the md-checkbox directive.
I was wondering if anyone knows how to make this into a tri-state checkbox.
The three states (and the associated variable ...
1
vote
0answers
35 views
AngularJS Custom Directive Accessing Scope Data
We are brand new to AngularJS but are trying to display some html tooltips from a custom directive in Angular and since new new to this technology are struggling to come up with a proper solution to ...
0
votes
0answers
24 views
Angular Repeater with Dynamic Templates
I was wondering if it was possible to solve this using angular and if so, what would the premise be?
I'm creating a history log of changes/updates that are stored in a logs table. And I would like ...
0
votes
0answers
20 views
Use existing controller in a directive
I'm having a controller like
.controller("MyFunnyCtrl", function(...) {
this.hello = "hello";
...
})
which works fine. As advised here, I've created a trivial
.directive("myFunny", function(...
0
votes
1answer
35 views
Directive linking to enclosing directive controller with 'require'
I'm trying to get an enclosing controller in an angularjs directive. I also need an ngModel and this should work like
.directive("myFunnyDirective", function(....) {
return {
require: ["...
3
votes
4answers
55 views
AngularJS: Directive isolate scope - scope variable undefined
Please, can someone explain me, why attrDir's scope variable is visible, and oneWay's not?
I thought that scope: {} is isolated as well.
angular.module('test', []);
angular.module('test').directive('...
0
votes
0answers
39 views
Event propogation not working in AngularJs?
I made a custom contextmenu directive. And I am trying to log something when the contextmenu opens. However the same function runs 5 times, when its supposed to run once. I am trying to e....
0
votes
2answers
26 views
ReferenceError: lecturerFac is not defined
When I load the html page, my controller retrieves data from an API end point regarding a course. The page gets populate with the data about the course. But at the same time I want to populate part of ...
2
votes
1answer
23 views
Angular.js bindToController in directive: data, binded to controller, is not available as this.foo?
I've created a simplest possible directive with bindToController syntax, which resulted in a crysis of faith due to what I've seen:
function foobar() {
return {
restrict: 'E',
...
0
votes
2answers
36 views
AngularJS convert to be minify-friendly
When I minify my js scripts, I'm having an error on of Unknown provider: eProvider <- e <- myDirective
angular
.module('myApp', [])
.run(['$state', run])
.config(['$provide', config]...
0
votes
0answers
12 views
How to update the isolated scope through another brother scope,not by its parent scope? Plz , the details are as follow
The SPA includes 5 tabs ,in each of it ,there is a directive , named 'loadMore', to load more information corresponding to five different types of customers. The directive will send $http request ...
0
votes
4answers
45 views
trying to add loading wheel using angular when i make ajax call?
I am trying to implement loading wheel directive when we make ajax call so during the response time i want to display loading wheen, With below code i do not see any error neither the loading wheel.
...
0
votes
3answers
24 views
How to get correct attributes of a directive that is used multiple times on the same page?
Angular 1.4.8
Here is JSFiddle.
I have a directive used twice on one page. I only change some attributes of the directive. It appears, that I get only the last defined attributes inside ...
0
votes
0answers
25 views
How to call a function passed as parameter in a directive?
// post-cards is a directive
<div class="post-cards event-posts" data-list="posts" data-opts="postConfig" data-infinite-scroll="getPostsOnScroll()" data-infinite-scroll-distance="3" data-...
-1
votes
0answers
25 views
Force 3rd party Angular directive rerender without changing the directive
Found many ways to re-render a directive with changed data, but they all implies some modification on directive. As I use some third party directives I would not change, is there a method to force re-...
0
votes
3answers
21 views
Directive template is shown before it's created
This problem happens in IE and Firefox, not Chrome.
In this plunk I have a directive that has a template containing a div. The div is shown with ng-show="show" where the variable show is set to false ...
0
votes
2answers
65 views
Passing a variable to directive from controller on Button click
TLDR; I don't want to databind two input boxes, but rather pass the variable from the controller to the directive (which has a controller inside).
Currently I have the following
HTML page
HTML ...
0
votes
1answer
13 views
ng-disabled on both directive element (replace: true) and in directive template combine improperly
It appears using ng-disabled on an element directive with replace: true and on the root element of the directive's template results in angular incorrectly trying to combine the two ng-disabled ...
2
votes
2answers
31 views
Custom Directive fails to compile within ng-repeat
Could anyone help me solve a scoping issue when compiling a directive within ng-repeat?
https://plnkr.co/edit/y6gfpe01x3ya8zZ5QQpt?p=preview
The custom directive input-by-type can replace a <div&...
0
votes
1answer
16 views
Disable directive based on dropdown value
I want to disable the multiselect dropdown directive based on the selection of the other drop down.
This is the 1st drop down
<div class="col-md-2 col-sm-2">
...
0
votes
2answers
47 views
AngularJS - $compile is not a function
I have been trying to figure this out for quite a while, hopefully someone can point out what is wrong.
I am trying to compile the HTML template because it does not call the function removeAllImages()...
0
votes
1answer
44 views
How do I access controller function from directive AngularJs?
On the main scope, I have a ng-repeat running.
<table class="datatable" prevent-right-click visible="isVisible">
<tr ng-repeat="t in templateData">
&...
0
votes
0answers
25 views
Passing a string into custom isolate scope directive with two way binding needed
I have a simple Angular custom isolate scope button directive that needs to use two way data binding so things can be updated dynamically.
scope:{
buttonLabel: "@?",
buttonIcon: "@?",
...
0
votes
2answers
33 views
Sharing Data between Child Directives
I have three directives defined:
Parent
This should share variables between the other two directives - Child One and Child Two.
Child One
This contains an input field representing a search term. ...
1
vote
2answers
32 views
Why is my decorated directive not overriding the original's methods in AngularJS?
Trying to follow the template in the Angular Decorator guide (https://docs.angularjs.org/guide/decorators), I've tried to create a directive and decorate it.
The directive is supposed to show the ...
0
votes
0answers
26 views
Ng-repeat on wrapper of multiple options inside <select> cause the options to receive null
so what I want to accomplish is populating a select element with a recurisve json, like so:
[{
"siteId": 1,
"name": "Test 1",
"siteTypeId": 2,
"childSites": [
{
"siteId": 3,
"...
-2
votes
1answer
35 views
How would I render a list of custom object type in Angular?
I have a List in java. The custom object has three fields, The title, Instructions, Data. I want to be able to render the list in a meaningful way using angularjs. I'd like to have the title at the ...
0
votes
0answers
23 views
load textbox value on angucomplete item selected
I'm trying to load value in textbox when angucomplete item selected.
This is how I declare the directive in my html file:
<angucomplete id="autoName" placeholder="Name" pause="100" name="customer"...
0
votes
0answers
31 views
Angularjs - Test unit directive only numbers
I have a directives.js file with two directives and I would like apply unit testing necesary, to improve coverage, but I do not know how to do it
This the directive.js file:
(function () {
'use ...
0
votes
1answer
52 views
angular.js - passing an object from directive to the view controller
*Please note: there is a Plunker link:
https://plnkr.co/edit/PAINmQUHSjgPTkXoYAxf?p=preview
At first I wanted to pass an object as parameter on directive click event,
(it was too complex for me), so ...