Tagged Questions
0
votes
0answers
17 views
how to refer to another html element in a directive
For my convenience, i created a directive 'twActionButton' which is performing an API Call to my backend.
some of these calls last longer & i want to indicate progress on the table row.
...
0
votes
0answers
18 views
ng-class is not applied on element with ng-repeat
I have the following custom directive:
angular.module('Interfaces').directive('Interfaces', function() {
return {
restrict : 'A',
scope : {
minor : '@'
},
templateUrl : '...
0
votes
0answers
8 views
angular-translate inside directive template not resolved
I have a custom directive in AngularJS (1.6) whom I want to pass a translation key inside a placeholder attribute. That key should be used inside the directive template to display the translated ...
0
votes
1answer
21 views
AngularJs pass a fitler expression to directive with true at the end
I have a directive for the mover list called smDualList. The directive has the following template (partial code):
<div>
<select class="select-list" multiple
...
3
votes
1answer
53 views
How to link a controller to a directive in angular?
Lets say i have the following html structure:
<div ng-app="testApp">
<div ng-controller="controller1">
{{controller1}}
</div>
<div ng-controller="controller2"&...
0
votes
1answer
14 views
Better to apply controller through ng-app directive or .config controller property
Is there any pros or cons to how I apply a controller to a document/element, either by using:
ng-controller="appCtrl" with-in the HTML
OR
app.config(['$routeProvider', function($routeProvider){
...
0
votes
0answers
27 views
Why form invalid when all element in form are valid?
I have a form with 2 element.
Problem is all element in form is valid but form invalid
Here's my form:
<form name="frmTest" id=test>
<input-validate class="form-control input-sm" ng-...
2
votes
2answers
45 views
Build template string inside directive
I'm trying to build a string of HTML code inside the directive and then use that as the directive's template.
I tried this but it doesn't work.
myApp.directive('myDirective', [function() {
...
0
votes
1answer
24 views
Directive with isolate scope is not updated when an element pushed into the array in controller
I am trying to implement a basic recent searches list on my page. When the search button is clicked two inputs are concatenated and pushed to an array called "recentSearchItems". recentSearchItems ...
1
vote
1answer
16 views
Is it possible to render angular directive templates with isolated scope?
I came across a strange behavior with an angular directive using an isolated scope. Apparently the template is resolved using the old scope (even if transcluded), not the new one.
This sounds a bit ...
-3
votes
0answers
21 views
directive element click update from controller
I have link function in my directive which has following structure inside it:
$(element).click(function(){
if(){}
else{}
})
Now i have an event in the controller which should update the ...
1
vote
1answer
16 views
How do i receive and use a string into template of a directive?
I'm starting to work with directives and right now i'm trying to render buttons using permission levels.
Let's say i want to render this button
<a ui-sref="#" data-toggle="modal" data-target="#...
0
votes
1answer
31 views
Define a scope in directive and use it in a view
I am using angular-treeview directive. Here , It is taking some time to load the tree, so I want to show a spinner for that time. So, I want to define a variable in directive and that will be used in ...
2
votes
1answer
25 views
How to pass a directive as an attribute to another directive ? AngularJS
The idea is that it should work as follows,
//This is pseudo code:
directives = [directive1, directive2, directive3]
<ng-repeat directive in directives>
<main-directive attribute = "{{...
0
votes
0answers
22 views
Use generics for angularJS directive with typescript
I implemented an autocomplete directive with AngularJS (1.6) and Typescript. The directive executes a passed query to the server and fills a drop down with the results.
I would like to re-use this ...
0
votes
1answer
24 views
where to keep css files in AngularJs
for a good practice,In which directory we keep multiple css files like ( style.min.css , font.awesome.css) in Angular4
-1
votes
1answer
24 views
how to use ul li ng-repeat inside directive using append
how to append ul li ng-repeat at directive angularjs?
This is my array list.
var getAreaList = [
"City",
"Central",
"North",
"South",
"East",
...
0
votes
1answer
38 views
how to use ng2-chart.js directive in angular 2?
I've installed ng2-charts using npm
npm install ng2-charts --save and npm install chart.js --save
then added below into index.html
<script src="node_modules/chart.js/src/chart.js"></...
0
votes
1answer
18 views
angularjs data binding disappearing- Failing silently
I can not create complex data models in my controllers.
every time I create them the code seems to fail silently
simple data models like
$scope.conversationList = [123456];
work just fine both ...
0
votes
1answer
19 views
Validate that 2 angular Form fields do not have the same content
I have an angular form consisting of two fields location A and Location B.
What I'd like to achieve is a directive that compares both fields and validates accordingly, style the valid or invalid ...
0
votes
0answers
33 views
Sharing scope variable between sibling directives
I'm working on a table that can be expanded/collapsed by clicking on the header bar. To accomplish this, I have two directives that appear in the markup as siblings: slideToggle and slideable. I ...
0
votes
1answer
44 views
Angular JS - Pluck on directive attr
I want to know if there is a way to get all the values of an object in a diretive in Angular JS. For example I have to following array:
var example_data = [{ request: 'request1', totalRequests: 100, ...
-2
votes
1answer
34 views
Where should I write cors filter enabler code in angularjs
This is my js file, the following code is inside .controller
xhr.onreadystatechange = function () {
if(xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200){
$http.post(...
0
votes
1answer
25 views
Angular modal window function not working properly
I have an Angular function within a PHP partial page that appears to not be working properly. The function is attached to all images that are loaded on to the page from a MySQL database, and is called ...
0
votes
0answers
31 views
Angular 1 component save current input values when clicking outside the input or other inputs
i am using angular material and have a modal that pops up with places where you can edit data, this inline editing area is created using a components. When user click the values, these values become ...
0
votes
1answer
26 views
AngularJS Directive Event Listener Not firing
I have a directive like so:
<div ng-repeat="(key, value) in $parent.item.detailedPlan track by $index">
<ul contenteditable="true" class="plan-actions" data-placeholder="Add Plan ...">
...
0
votes
1answer
31 views
How to optimize AngularJS config function
I have following config functions and run functions in my app.js file. What is the best way to optimize these function method ? can we move these into one single config function ?
Or Can we move these ...
0
votes
1answer
14 views
Number only Custom directive not calling on space key
I have written a custom directive in angular-1 to allow only number in a text box (no alphabets including space).
For example in PhoneNumber text box which should only accept Numbers.
But my ...
0
votes
1answer
15 views
ng-metadata @Directive: how to set input value?
I've got a pretty simple directive, which should update the input value on blur.
The blur handler is getting called, but I can't manage to set the input value.
import {NgModel} from 'ng-metadata/...
-2
votes
0answers
23 views
Need help converting $stateProvider functionality into $routeProvider
In my codebase I use $routeProvider, but I want to include functionality similar to this $stateProvider example.
What would be the $routeProvider equivalent to the following code?
angular
.module(...
0
votes
1answer
31 views
How to draw dynamic chart using jHipster?
I wrote the application which gathers data from the server each minute. All gathered data is storage in PostgreSQL database.
How to create charts which display data in dynamic changing charts?
Is ...
1
vote
0answers
27 views
How can I add and synchronize a scrollbar at the top and bottom of a div?
I'm trying to create top and bottom scrollbars on a table in angular1 using a directive. Although it creates the scroll bars the top scrollbar thumb doesn't appear even if there is an overflow in the ...
-1
votes
1answer
22 views
How to do pagination with uib-pagination directive (ui.bootstrap)
I am doing pagination with uib-pagination directive.Items are displaying properly but in the last page I'm getting problem. In the page values are getting duplicating. I don't know what exactly the ...
0
votes
1answer
22 views
Angular Js directive update scope value on DOM
I have a directive which updates DOM according to mouse-events.
<input mask-directive
ui-mask="{{phoneMask}}"
placeholder="{{phonePlaceholder}}"
ui-mask-placeholder
class="form-control input-phone"...
0
votes
1answer
27 views
ng-repeat and 'polymorphic' directive
I'm wondering if there is a way to build a custom Element directive to use with ng-repeat in this way:
<div class="list">
<my-custom-directive class="item item-icon-right" ng-repeat="a ...
0
votes
1answer
40 views
angularjs: Dynamically build a compileable directive with bindings
im currently trying to build a component which gets an object with specifications which directive it should render.
So this is my angular component componentRenderer.js
angular
.module('app.core'...
0
votes
0answers
14 views
File Upload directive : Not able to call controller function on change event
I have create a directive to upload file from my angular js application , Here my code:
Directive :
module ec.directives {
export function fileUpload() {
return {
restrict: ...
0
votes
1answer
30 views
handle APlayer through angular js - play music dynamically
I am new to angular js - trying to build an audio play using Aplayer
Task:-
1. Play music dynamically
2. On click of album get json data and add to aplayer
(function() {
'use strict';
...
-1
votes
1answer
40 views
AngularJS On selecting radio button set select field value
How do I set the select fields value by clicking radio button
0
votes
0answers
15 views
Angular component model not bound to transclude template
I don't understand why the transcluded template doesn't have access to the controller instance, it only seems to work when you actually use the templateUrl or template option.
Demo: http://jsfiddle....
0
votes
1answer
49 views
AngularJS Radio button and checkbox not binding to model
I'm working on business hours of operation where the user can select a day and choose its operation hours or choose "closed" radio btn and let the fromTime and toTime be set as closed.
If he chooses "...
0
votes
0answers
23 views
Error: [$compile:tpload] when trying to append a button to the page via custom directives (AngularJS)
This is my custom directive js file called viewSummary.js
app.directive('viewSummary', function() {
return {
restrict: 'E',
scope: {},
templateUrl: 'js/directives/viewSummary.html'...
0
votes
1answer
39 views
hasClass inside directive always returning false
I've got this looping 7 times on the HTML side:
<div ng-repeat="field in response.Fields">
<input type="text" name="abc" ng-class="field.DataType == 'DATE' ? 'form-control datepicker' : '...
0
votes
1answer
35 views
AngularJS submenu with ng-show
I have made a directive that has menu-items in it, some of the menuitems have submenu items in them. Directive is made so that when you click on the menu-item it opens its submenu. My problem is that ...
0
votes
1answer
41 views
Best performance when creating custom directive when looping in AngularJS?
The following code is being used 10 times throughout my app.
I'd thought I would refactor it to a custom directive:
<div class="names-container">
<ul>
<li ng-...
1
vote
1answer
43 views
Why does AngularJS ng-repeat filter for search term not work?
I'm trying to make a table that filters to only show rows that contain whatever string is in the search box. I have a simple example that I'm just trying to get to work based off the w3schools ...
1
vote
1answer
37 views
AngularJS not putting an array in scope?
So I'm attempting to use Angular JS and the angularSoundManager module to create a music player. I can get songs and the player to work fine, but when I tried changing the main array to be albums with ...
0
votes
1answer
30 views
how to test ng-form item validity with jasmine in angular js
I try to unit test an angularjs directive with jasmine.
My directive consists to complete, on blur event an id with leading zeroes and then check if this id already exists in a list of id (provided by ...
0
votes
1answer
31 views
Angular UI - Watch value from input in Popover Template
I'm trying to create a directive which uses the Angular Bootstrap Popover, which contains an input. Everything works fine, except the watch is not triggering.
Here is a Plunker.
The directive looks ...
1
vote
1answer
36 views
Using Same Directive for Different Data
I am a little new to Angular directives and was wondering if there was a way to use the same directive multiple times but bind in different data? (im sure theres a way i just dont know how!)
For ...