Tagged Questions
0
votes
2answers
22 views
Angularjs two way data-binding for form data POST
Using angularjs, I am trying to populate a form dynamically and then submit the forms data via POST to a server.
I created a data variable in my controller (to POST later)
$scope.data = {};
Then ...
1
vote
0answers
20 views
Moving angularJS elements created by ng-repeat
I'm trying to move elements that are created by a ng-repeat into some columns. I successfully did it with a directive, but the problem happens when I sort the array of objects on which ng-repeat ...
2
votes
1answer
29 views
Angularjs show/hide and alternating styles
I have a list of divs that display information about products. The core information is the same, but certain fields are only shown or hidden (via ng-show/ng-hide) for certain product type. This ...
1
vote
1answer
26 views
Call controller function from angular directive
How can I call angular function inside directive which is defined in controller?
var app = angular.module('myApp', ['ngResource']);
app.directive('hello', function () {
return {
scope: {
...
0
votes
2answers
23 views
Angular directive not showing
I've got a tiny problem with an angular directive that's now working and I don't know why. I think it's a fairly simple issue that I'm overlooking, maybe you can help me out.
Directive is defined ...
0
votes
1answer
19 views
AngularJS 1.2.1 - dynamically adding directives errors unless they do not replace source element
I have upgraded my application to AngularJS 1.2.1 and am running into an issue with previously working code, which I am unable to solve.
I have a page where the user builds up the content from a ...
0
votes
1answer
11 views
Element unspecific AngularJS directive template
I'm developing UI and typography based directives for Angular. In such cases, the element the directive is being applied on is unknown - anything from a div, span, h1 to an h5.
The reason for using a ...
0
votes
0answers
14 views
Angularjs: animation service
First off I am using ng-boilerplate, so my dependencies have been declared in my controller.
My directive in HTML is as follows:
<div div-float="logo.left" class="letterhead-widget" id="logo">
...
0
votes
0answers
13 views
Angular directives: mixing attribute data and ngModel
I've had luck building directives that share scope, and ones that isolate scope, but I'm having trouble figuring out the correct way to do both.
<input type="text" ng-model="search" append-me ...
0
votes
1answer
20 views
Angular Directive - Nested Object in Attr
There is great solution provided for this question, that shows how to use a directive to display <tr>'s for nested objects. However, I need to take it a step further and pass a nested object ...
0
votes
1answer
19 views
Destroying child directive scope
In my application i've created two directives, one parentDirective and childDirective.The parent directive dynamically creates child directives depending on some criteria defined in parent on button ...
0
votes
1answer
32 views
AngularJS - hide a div when clicking in an inner element using a directive
I'm trying to hide a box when clicking on a link inside this box.
I wan't to use a directive to be able to add more code when once the box is hiden and to keep it generic so I can use that with other ...
0
votes
1answer
21 views
AngularJs: call function from directive attribute
This seems simple enough and I have it working to some degree but there's some issues with my solution.
The scenario is that I want to pass a function (toggleValue()) to a directive and then call ...
0
votes
2answers
21 views
AngularJs ng-if for displaying or skipping on element
I am using AngularJS.
I have the following template:
<div>
... html content ....
</div>
I want to wrap the html content with an anchor only if the url model is not empty. For ...
0
votes
2answers
25 views
$apply with two operations, where one depends on the other
In my angular directive, in a callback, I call $apply to:
Set $scope.model.something
Invoke $scope.onAction() which uses model.something.
I do this in one $apply call, but at the time onAction() ...
1
vote
1answer
23 views
AngularJS directive loaded dynamically in ng-include do not work
I have a custom directive which adds some html.
myAppModule.directive('myDirective', function() {
var linker = function(scope, element) {
return element.html("<b>directive ...
0
votes
1answer
38 views
tabs directive not working
Here is my html :
<ul id="tabs" class="nav">
<li class="active">
<a href="#tab1" tabsMenu>Overview</a>
</li>
...
0
votes
1answer
31 views
What is right Angular way for triggering handsontable loadData by mouse click
I create directive that loads jquery handsontable in a true Angular way. But this is the true way only for the first loading of handsontable. What if I need to change table data after the mouse click?
...
2
votes
2answers
41 views
Angular js - Highlight dom when value changes
Angular noobie here.
I would like to know what is the best way to change the dom when a value in the scope changes by some means. I read that its not good to put the dom manipulation logic in the ...
0
votes
1answer
19 views
Get return value in callback Angular js Directive
I have created one directive in Angularjs in which I need to use callBackMethod, so that I can call Controller's Function.
Controller's function is called.But Controller's Function is returning some ...
0
votes
0answers
18 views
Using ngModelCtrl and inputs
I've been trying to wrap my head around how to use ngModelCtrl properly.
Firstly, I have a directive that generates a form based on a list of properties. So I might have a list of properties for an ...
0
votes
0answers
10 views
completed parameter ngUpload, how is this set?
using Angular's ngUpload. file uploads fine but completed returning false. Have tried returning both 201 and 200 from the server, and content is fine and available but completed is always false. ...
0
votes
0answers
16 views
AngularJS and Flexslider loading
How can I get Flexslider to fire once all my API images have loaded?
The problem is that Flexslider fires before Angular can pass in the large images I'm retrieving from an API.
If I refresh a ...
0
votes
2answers
25 views
How to output data from a directive to a controller, and should I?
Use case
For use in a form, I created a directive that tracks changes in an array. It allows changes to be reverted and deletions and additions to be stored separately. It allows for an array (one to ...
0
votes
0answers
24 views
Angular directive wont compile from json api
I'm trying parse html coming from an api and render the angular directives it contains.
Example json.
[{
id: 6,
html_body: "<h3>Hello ...
1
vote
1answer
26 views
Angular $animate - delay between ng-enter and ng-leave - not sure why?
I would be so grateful if someone could take a look at this. It is a very simple angular slide show using angular.enter and angular.leave, but there is a delay between ng-enter and ng-leave that I ...
1
vote
1answer
27 views
AngularJS Sharing Directive Scopes and Iterating Over Values
I am trying to create a directive who gets it values from a child directive and that populates the fields in the view. An example:
app.directive('directive1',function() {
return {
...
0
votes
1answer
45 views
AngularJS $setViewValue() Not Responding in $parsers.push()
I have a directive. It requires ngModel, and in the link, I should be able to use modelCtrl parameter to use $setViewValue(); and $render(); in conjunction to return to change the value in my input ...
0
votes
1answer
47 views
How to get the form data when the form is in a directive in Angular?
I have this this template:
<div class="modal" id="popupModal" tabindex="-1" role="dialog" aria-labelledby="createBuildingLabel" aria-hidden="true">
<div class="modal-dialog">
...
0
votes
0answers
24 views
How to expand a tree in javascript which is generated using a recursive directive in Angular?
I build a tree using a recursive directive:
app.directive('recursiveListItem', ['$http', 'RecursionHelper', function ($http, RecursionHelper) {
return {
restrict: 'E',
scope: {
...
0
votes
0answers
30 views
AngularJS - Form validation, how to scroll to first invalid input
I want to scroll document to first invalid input in the form on button click (without using jquery of course). What a proper (angular-way) approach for this situation? Thanks.
0
votes
1answer
24 views
Angular directive works on an element in the first page but stop working after navigation (probably a scope issue)
the directive code
directive('stFloatBar', function($log,$window){
return{
restrict:'A',
replace:true,
transclude:true,
...
0
votes
1answer
14 views
AngularJs accessing attribute difference, via linking and scope
Can anyone explain whats the difference between accessing directive attribute from the scope as in :
scope: { someVar: '=' }
vs
link: function (scope, elem, attr, ctrl) {
attr.someVar
}
It ...
0
votes
1answer
25 views
How do I inject a directive template based on an option selected from a dropdown
Here is my html:
<html ng-app="myApp">
<div id="inputPane" ng-controller="MyInput">
<select ng-model="dataSource" ng-options="data.Name for data in dataSources">
...
0
votes
1answer
60 views
AngularJS Directive - Template Select Not Updating Ng-Model
I have two directives in my module. The first is from https://github.com/banafederico/angularjs-country-select. I used it as a model for the second. The two directives represent input fields, but ...
0
votes
1answer
19 views
Binding angular scope inside a fancybox not working as expected
I created an angular directive to work with fancybox and it partially works.
Check out the plunker
The data binding works ok, if I change a variable outside the fancybox and then open the fancybox ...
0
votes
2answers
34 views
AngularJS directive - complex directive name
We started to use the AngularJS in the project that supposed to be large and decided to use "modular" project structure and naming conventions. Everything is works good, except directives.
Our ...
0
votes
1answer
20 views
Angularjs Directive:- scope not defined error
myApp.directive('qsetAnswer', function(){
var linker = function(scope,element,attr) {
console.log(scope.body); // this prints fine.
};
return {
restrict:'A',
scope: '=info',
...
0
votes
0answers
28 views
Angular : issue when I repeat a directive
I have an issue when I use several time my directive with differents attributes for each :
I have a directive metadot-translation that I use like this in my html:
<span id="hello" ...
0
votes
1answer
29 views
Passing an object to a directive as an argument
I have a view and a controller for it:
<app-head options="options"></app-head>
app.controller('homeCtrl',function($scope){
$scope.options = {
first: {
description: "A ...
0
votes
0answers
16 views
In template of the directive i had added the click event which was handling in the link .But the issue is that the function is calling two times
this is my directive .IN this i had added the ng-click for the li with the display of the item name but the function is calling for two times .Any one can you please explain it was happening .below ...
1
vote
1answer
59 views
How to pass a function reference in a recursive directive in Angular?
I have this directive:
app.directive('recursiveListItem', ['$http', 'RecursionHelper', function ($http, RecursionHelper) {
return {
restrict: 'E',
scope: {
parent: ...
0
votes
1answer
20 views
AngularJS Scroll to element prevent browser from jumping
I've written an app that has a list of blocks.
Each block contains links to other blocks.
When a link to a block is clicked e.g #/home/page-19, the page animates down/up depending on current ...
0
votes
0answers
28 views
angularjs: how does the replace attribute works for directive ?
I'm trying to figure out how the 'replace' attribute work for directive. I've run into a scenario when setting it to true was causing my code to break.
The directive:
...
1
vote
3answers
33 views
Create angular directive to be used in any module
I Have lately used angular.js, but I need a small explanation regarding Directives.
How can I create a directive without linking it to a specific module and can be used in any module, such as the ...
1
vote
4answers
70 views
AngularJS directive gets not updated if scope variable changes
I've tried to write a small directive, to wrap its contents with another template file.
This code:
<layout name="Default">My cool content</layout>
Should have this output:
<div ...
0
votes
1answer
28 views
How get Data from AngularJS using a scope with different kinds of Propierties?
I have assigned to an scope object an object (class) but this class has two attributes: two arrays and two strings, how can i get the values from this $scope??
Ex: Object to Assign:
var Address ...
0
votes
1answer
43 views
Changing colour of angularjs slider with pointer
Hi I'm building a slider in angularjs that changes color depending on where you move the pointer.
1.) if the pointer is on the rightside, the bar will be red
2.) if the pointer is on the leftside, ...
-1
votes
1answer
27 views
In html the radio button text clickable is not happening ? I had used the two list items in ul
See my problem is that i had written the code in angularjs with the using of ng-repeat for two times and based on some condition i had differentiated thatand one more important point is that i had all ...
0
votes
0answers
26 views
Model bindings not working on checkboxes in a nested loop of a directive
I am creating a grid of checkboxes to enable a user to select different events and age classes for an athletics meeting. The events are the columns, the classes are the rows.
Here's the plunk: ...