Tagged Questions
0
votes
1answer
34 views
Angular JS attribute Directive taking variable
I'm trying to pull in a variable for an angular JS directive used as an attribute.
Let's use petFilter as an example.
HTML:
<input type="text" name="catName" pet-filter='cat'>
<input ...
0
votes
0answers
10 views
Generator/Seed for AngularJS Directive Library
There are multiple projects to easily bootstrap Angular application, e.g angular-seed, Yeoman angular generator.
Is there anything similar for AngularJS Directive Library? (library of reusable ...
1
vote
0answers
27 views
Can I make an Angular directive to match a CSS selector (not just tag name)?
I can define a directive that affects all <a> elements in a document like so:
myApp.directive('a', function() {
return {
restrict: 'E',
link: function(scope, element) {
// Some ...
0
votes
2answers
17 views
Giving immediate feedback upon touching a touch screen
We are using AngularJS, Bootstrap, and Phonegap to build an application targeting predominately the iPad. So far we have been using the Bootstrap list-group-item class. We are finding that upon ...
0
votes
0answers
20 views
anglar js setting model value from directive and calling a parent scope function holds on to the previous value inside that function
This is my directive
'use strict';
barterApp.directive('autosuggest', function($timeout, $http) {
return {
restrict: "E",
scope: {
modelupdate:"=",
suggestions:"=",
...
1
vote
2answers
21 views
directive link function execution order
I'm kind of new in all this angular...
I have a custom directive, lets call it myDar.
Inside this directive I define a link function.
In my html I want to to use multiple nested tags of this ...
0
votes
1answer
17 views
Force IE compatibility mode off in IE using tags for browser mode
I am using html5 with angularJs using follwoing tag
This results in Browser mode set to IE8 Compat, and Document mode set to IE8 Standards.
<!doctype html>
<html ...
0
votes
0answers
13 views
Directive inside bs-tooltip is not evaluated
I am trying to have a <ul> element with its own directive (checkStrength) inside of an AngularStrap bs-tooltip title property, like this:
$scope.tooltip = {
title: '<ul ...
1
vote
1answer
26 views
angularjs autosave form is it the right way?
My goal is to autosave a form after is valid and update it with timeout.
I set up like:
(function(window, angular, undefined) {
'use strict';
angular.module('nodblog.api.article', ...
0
votes
1answer
22 views
Angularjs form with “name” attribute set, ignores default values
To validate a form in Angularjs, the "name" attribute needs to be set on the form. When the "name" attribute is set, setting default values in the controller won't work anymore.
Here's an example to ...
0
votes
1answer
8 views
map two directive names to one directive
I've got a directive which is set using a class because most of the properties are related to that class.
The class is resizable-sideways or resizable-updown.
Right now, the directive is called ...
0
votes
1answer
20 views
Transclude ignoring template text
Can anyone tell me why in the example below the text "Say Hello" is not being included in the transclusion? So you can see the button and the "Goodbye" link but not the text from the template.
Many ...
0
votes
2answers
31 views
Angularjs directives without html in the code?
I'm learning AngularJS and I have a bit of a problem with directives. I don't like how they look. Specifically, I don't like when there is a lot of html in the middle of the javascript. Look at the ...
0
votes
2answers
31 views
Why doesn't my $scope reflect my controller being initialized?
Question:
Why is {{ name }} resulting in blank?
Plunker:
http://plnkr.co/edit/32t8u4VL9BiuhHcC80LF?p=preview
Script:
var app = angular.module('app', []);
app.controller('MainCtrl', ...
0
votes
1answer
22 views
AngularStrap tooltip disables my custom directive
I am trying to get the bs-tooltip AngularStrap directive to work with my own custom directive called "checkStrength" which checks the strength of a password. When using either of these directives ...
2
votes
1answer
27 views
Initialize Zurb Foundation 5 in an AngularJS Directive
I've created three plunkrs to illustrate my problem. I'm trying to create an AngularJS Directive that will initialize foundation and apply the necessary javascript to the loaded template. At first I ...
1
vote
1answer
14 views
angular directive encapsulating a delay for ng-change
I have a search input field with a requery function bound to the ng-change.
<input ng-model="search" ng-change="updateSearch()">
However this fires too quickly on every character. So I ...
0
votes
2answers
28 views
Do I NEED to supply a template for an Angular directive to wrap content?
I think I might be trying to fit a square peg into a round hole here. What I want to do is to define a convention for attaching some generic JavaScript functionality to a particular HTML attribute.
...
1
vote
2answers
28 views
Change the label for an optiongroup created with ng-options
I want to display a HTML select element with optiongroups by using the angularjs select directive.
However I would like to control the value of the optgroup label attribute (every label should be ...
0
votes
1answer
11 views
Get the bounding rect for an element outside of a directive
Inside a directive I want to get the result of getBoundingClientRect() for a DOM element that is no where near the element of the directive.
How should I go about this? Service that just returns that ...
0
votes
1answer
25 views
How to only listen once on $document from inside directive
I have an angular directive that needs to listen for click events on $document.
Let's call it clickDirective.
The click listener is added inside its link function.
The problem is that if there are ...
3
votes
0answers
174 views
React compared to Angular directive with isolate scope
I have read Facebook and Instagram engineers saying that React itself lack of infrastructure to build a big project, it is only the V in MVC. Instagram seems to use it with some Backbone code for ...
0
votes
3answers
22 views
ng-app V/S data-ng-app in AngularJS
In AngularJS when using ng-app: ng-app found in the document will be used to define the root element to auto-bootstrap as an application.
In some of the application it is being used as data-ng-app.
...
0
votes
1answer
24 views
AngularJs ng-if function call from same controller not working
<div ng-repeat=" x in z">
<div ng-if="function(x).y" >
display this
</div>
</div>
In the above code, ng-if function(x) is not getting called without ...
0
votes
1answer
22 views
angularJS: watch async data in directive
I'm trying to watch a async data in my directive, here is my JS code:
(function(angular) {
var myApp = angular.module('testTree', []);
myApp.config(function($httpProvider) {
...
0
votes
1answer
12 views
How to use relative paths for images while maintaining a directory structure in angular JS?
I am using angularJS for implementation. I have created a directory structure for my application so that html pages and js will be identified. I have created a header.html which contains only header ...
0
votes
0answers
32 views
ng-show directive - inconsistent behavior
I'm trying to implement a versioning system for my application and I've tied one of the DOM elements that display the versions to the ng-show directive.
<a href="#" onclick="return false;" ...
0
votes
1answer
41 views
Bootstrap popover directive and nested element with Angularjs
I've been trying to create a directive which I can arbitrarily add to an existing form (as attribute), which makes the form become a popover upon clicking on a nearby trigger link. I've got the ...
0
votes
0answers
7 views
AngularJS best practice for a directive to create a google map [migrated]
I have a considerably large directive which is doing many things: First it renders a Google Map, then it adds a listener to check when the bounds of the map change, then it renders points on the map ...
1
vote
2answers
45 views
Automatically pass $event with ng-click?
I know that I can get access to the click event from ng-click if I pass in the $event object like so:
<button ng-click="myFunction($event)">Give me the $event</button>
function ...
0
votes
2answers
23 views
Require directive on template
I am using RequireJS in my Angular app. I would like to require my pill where it is actualy used.
pill.js
define([], function() {
angular.module('app').directive('pill', function() {
...
0
votes
1answer
25 views
How to replace the element with ng-transclude
Is it possible to replace the element with ng-transclude on it rather than the entire template element?
HTML:
<div my-transcluded-directive>
<div>{{someData}}</div>
...
-1
votes
1answer
27 views
pass the values as a parameter to the ng click function
Hello take a look at sample code which is bind in html using ng-bind html directive.
var _test = new Object();
<div ng-click="myFunc()"></div>
I am able to get click successfully also. ...
1
vote
2answers
27 views
What is the main use of transclusion in angularjs
I have recently come across transclusion in directives, what is the purpose of having this concept. As far as I know its encapsulation of an object and have 2-way binding possibly. But this can be ...
0
votes
2answers
25 views
angularjs ui-date to show month year only
I am using ui-date directive (https://github.com/angular-ui/ui-date).
This UI Calendar component is getting Date by default. Can I get only month and year without dates.
How to get only month and ...
-1
votes
0answers
27 views
How maping is done at compile time in AngularJS? [on hold]
I have controller with method written in it
$scope.menuClick = function () {
//some code
};
Then this controller is assigned to directive. But I never called this method directly in my code. I ...
0
votes
0answers
27 views
Why ngModel.$render is not getting invoked?
EDIT 1: Fixed a bug, but still not working.
element.val(ngModel.$viewValue || '');
should have been:
dateInput.val(ngModel.$viewValue || '');
EDIT 2: The problem seems to be due to the isolate ...
0
votes
1answer
33 views
AngularJS directves: ng-click is not triggered after blur
DEMO
Consider the following example:
<input type="text" ng-model="client.phoneNumber" phone-number>
<button ng-click="doSomething()">Do Something</button>
...
1
vote
1answer
13 views
Why ngModel's $render is not called when the model changes in AngularJS?
DEMO
Why in the following example $render is not called when the button is clicked?
<input type="text" ng-model="client.phoneNumber" phone-number>
<button ...
2
votes
1answer
40 views
When ngModel's $render is called in AngularJS?
In this official example, what is the following code doing?
// model -> view
ctrl.$render = function() {
elm.html(ctrl.$viewValue);
};
As far as I can see, $render is never called.
When ...
2
votes
2answers
36 views
Angular JS directive “@” $scope in-$digestion
Given:
var myApp = angular.module('myApp', []);
myApp.directive('myDirective', function () {
return {
restrict: 'E',
scope: {
classToAdd: '@'
},
...
0
votes
1answer
30 views
Selected option in select box with angularjs
I have an application developed using Codeigniter and AngularJs. I want to set a default item in manual select box, but angular adds an empty undefined item.
<select class="form-control" ...
0
votes
1answer
45 views
Isolate Scope “=” binding and doted notation AngularJS
How do you create a 2 way binding with a nested property in an isolate scope with dotted notation. I thought 'myObject.data': "=data" would work, but it does not. I don't want to link everything in ...
0
votes
1answer
38 views
AngularJs : how to do a $watch on a function to evoid the error: $digest() iterations reached
I have a list with items. Each item of a list can be selected. If I select the item, it will be pushed in the cookies.
In my home.html (here I have the list with the items that I can add to cookies)
...
1
vote
3answers
37 views
ng-bind happend after my directive so I don't have the value
I have a div element with ng-bind directive:
<div ng-bind="sometext"></div>
I have a directive that gets an element, checks its value / text and adds a color to the element according to ...
0
votes
1answer
45 views
AngularJS do link function after $http response returned
I need to perform a link function in a directive after an http response returns. The idea is something like this:
<input type="text" my-field>
<script>
angular.module("mine")
...
2
votes
3answers
58 views
angularjs adding my own function to the existing ng-click
I have ng-click="foo()" which alert "foo"
In my own directive, if ng-click is found, I want to add another function to alert "bar"
I tried this
DEMO: ...
0
votes
2answers
31 views
how to access object property via isolate scope without two-way binding?
I want to pass a product's id to a directive like so:
<widget product-id="product.id"></widget>
I prefer not to use curly braces:
<widget ...
0
votes
2answers
46 views
Callback function in an angular directive
I want to have a call back function on a directive I wrote, without creating an isolated scope. The directive simply makes the element resizeable, and thus doesn't need a separate scope (and it's ...
0
votes
1answer
36 views
Call another directive from the directive with the same attributes and content
I want to override behaviour of one library directive, called "ui-sref". Lets see example:
<a ui-sref="edit" class="btn btn-small">
<i class="icon-pencil"></i> Edit
</a>
...