Questions tagged [angularjs-directive]

AngularJS directives offer a unique approach that enhances the capabilities of HTML by expanding its vocabulary. By utilizing directives, you can effortlessly handle DOM elements in a declarative manner, relieving yourself from tedious and intricate DOM manipulation operations.

AngularJS iOS keyboard not disappearing post iOS 10 update

After updating my device to iOS 10, I encountered an issue with hiding the iOS keypad when switching from one view to another. This functionality was working perfectly fine on iOS 9.3. Previously, I had programmed it to intercept certain elements and auto ...

Create a bespoke AngularJS directive for a customized Twitter Bootstrap modal

I am attempting to create a unique custom Twitter Bootstrap modal popup by utilizing AngularJS directives. However, I'm encountering an issue in determining how to control the popup from any controller. <!-- Uniquely modified Modal content --> < ...

ng-repeat on a transcluded directive fails to show the properties of the object

Having trouble with menu directives. The bottom three menu items work fine, but the ones generated by an ng-repeat are missing attributes like route, icon, and label when I run the code. The ng-repeat seems to be creating the correct number of menu-items, ...

Having trouble getting the auto complete feature to work in AngularJS with jQuery

I have been attempting for the last 5 hours without any success... Below is the code snippet: Within View: <input type="text" ng-model="foo" auto-complete/>Foo = {{foo}} Inside the controller: myapp.directive('autoComplete', functi ...

Updating Parent Scope Value in AngularJS Custom Directive

As a newcomer to AngularJS, I am eager to create my own custom directive that will display notifications or alerts on the web page. For example, when a user successfully updates their information, I want a brief message to appear saying "Your information h ...

AngularJS directives and controller scope

I'm looking to create a custom directive in AngularJS that generates a div element as a title and a ul list below it. The title should be customizable through an attribute, while the list content is controlled by a designated controller. Check out t ...

AngularJS form submission with and without page refresh

Looking to implement an AngularJS form directive where, if on /home page, redirect to /search/term and if already on /search page, submit without refreshing the page by simply changing the location. I am able to do both separately, but struggling to writ ...

Child directive of AngularJS fails to initiate when parent directive is using templateUrl

Feeling a bit weary of data grid initialization code, I have decided to experiment with AngularJS. My idea is to define my data grid inline like this: <grid src="http://my/web/service" page-size="10"> <column name="one" label="My First Column ...

"Transferring Attributes to Nested Elements: A Step-by-Step

Currently, I am in the process of creating a straightforward AngularJS directive that will convert input elements as shown below: <input type="text" name="FirstName" mydirectivename /> Into a format like this: <span><input type="text" nam ...

Angular Q for Beginners - Manipulating Service Results

After spending the entire day working on my inaugural Angular app, I have come across a fundamental query. My objective is to design a text field with two strings that describe the current URL route and action in the following format: You are on: {{urlRo ...

How can I retrieve the value of a select element that has been changed externally and update it

I have been working on developing a directive that integrates the functionality of the timezone picker jQuery plugin in order to incorporate a timezone picker "widget" across our application. However, I have encountered an issue where selecting a timezone ...

How can I customize the ngSrc directive in Angular to include a request header?

Is there a way to attach an authentication token to the URL request in angular js when using the ngSrc directive? If so, how can this be done? ...

Why am I struggling to show the success message on my basic CRM Angular web application?

I'm facing an issue in my Basic Angular app where the success message is not being displayed even after writing the correct code. 1)app.component.html <h1 class="c1">{{title}}</h1> <div *ngIf="success_msg;" style=&q ...

Implementing AngularJS drag and drop functionality in a custom directive

I am in search of an example that demonstrates similar functionality to the HTML5 File API using Angular-js. While researching directives for Angular 1.0.4, I found outdated examples that heavily rely on DOM manipulation. Here is a snippet of the pure Ja ...

Utilizing AngularJS to dynamically load content within popups

How can I dynamically load my JSON data in a popup when a specific div is clicked? Here is my code: <div class="col-xs-12 col-sm-6 col-lg-4 checkContent" ng-repeat = "appreciate in CustAppre" ng-click = "openBigDiv()"> <div c ...

Utilizing single-use bindings for a unique element directive

I'm working on a new directive called <call-card> and I want to implement one-time bindings as an exercise for optimizing future directives. Here is the definition object for this directive: { restrict: 'E', controllerAs: &ap ...

Execute JavaScript code once all the AngularJS template directives are fully loaded

On my HTML page, I am utilizing AngularJS template directives. Here is an example of how it looks: <div class="row"> <div class="col-sm-12"> <div logo></div> <div login-card></div> ...

Issues with Angular routing not accepting request parameters

As I attempt to navigate to a partial template upon form submission in Angular using ng-view, I encounter an issue with passing parameters through the URL. Specifically, I am trying to pass a parameter ?username=Joe and retrieve it in the new partial using ...

Using Angular's ui-router to pass and access parameters in your

I am currently facing an issue while using Angular with ui-router. Everything is working smoothly except for one particular scenario. I have designed a directive element that serves as the header of the page. This element consists of a menu with 4 links. T ...

My directive is not being loaded in Angular

Recently, I have started using Angular but encountered an issue with loading my directive. I am looking to load my directive immediately upon page load. Where should I load the data-show directive? <div class="row"> <div class="c ...

Is the ng-style not displaying the background image with the interpolated value?

I have been attempting to update the background image of a div using angular ng-style. Below is the code I am working with: <div class="cover-image" ng-style="{'background-image' : 'url({{data.image}})'}"></div> However, upon running the pro ...

What is the method to assign multiple values to ng-disabled in AngularJS?

Is there a way to assign multiple values for ng-disabled in AngularJS? The issue I'm facing is demonstrated in the following JS Fiddle: http://jsfiddle.net/FJf4v/10/ <div ng-app> <div ng-controller="myCnt"> <h3>A ->> < ...

What is the best way to create shared scope and transmit data within an Angular directive?

In my angular directive, I have the following code: app.directive('myDir', function () { return { restrict: 'E', scope: true, template:'<div>{{myindex}}</div>', link: function(scope, element, attrs){ console.log('test', ...

Enhance the functionality of a directive by incorporating the ui-mask directive

Recently, I implemented a custom directive for an input field that adds a calendar icon with a datepicker to the input. I have used this directive in various sections of my application and now I am interested in incorporating ui-mask - another directive I ...

Is there a way to implement a directive wrapper for ng-grid that allows the grid options to be specified using a directive attribute?

My goal is to create a reusable directive wrapper for ng-grid, where I can dynamically apply the ng-grid options through the use of an attribute. Below is the basic structure of the code that almost achieves what I am looking for: angular.module('myApp') ...

Utilize a specialized directive within the template of another custom directive

I have created a custom directive in angular called 'teeth' that generates multiple canvas elements on my HTML page. Inside the 'teeth' directive, I am trying to use another custom directive named 'draw' to trigger an event when a canvas element is click ...

What is preventing me from updating the value of a variable in this manner?

Trying to understand the reason behind an issue with overwriting a value passed to an angularJS directive using an isolate scope (@). When attempting to change the value of vm.index with the following: vm.index = parseInt(vm.index, 10) It does not seem t ...

Utilizing AngularJS to compare information within multiple JSON arrays and assigning a chosen option

$scope.opts = { unit: [ { id: 1, val: "px", name: "px"}, { id: 2, val: "%", name: "%"} ] } The options list array above is defined and the default option is set. $scope.user.unit = $scope.opts.unit[0]; The ...

An Illustration of Basic Nested Controller within Directive Parameters

Check out this code snippet app.directive('hello', function() { return { restrict: "E", templateUrl: "/Angular/Modules/Selector.html", controller: function () { this.message = [enter the attribute message here] ...

AngularJS: How to locate every occurrence of a directive

I am currently working on creating a directive that will allow users to navigate through different sections of the page using arrow keys. The challenge is that these sections are scattered throughout the DOM and I need to ensure that adding or removing ele ...

Modifying HTML elements in real-time using AngularJS

Looking for a way to display all posts from the database using AngularJS? You're in luck! I'm currently implementing an 'edit-post' directive to provide users with the ability to edit each post they see. Here's a snippet of the linking function: link: fun ...

Using AngularJS to implement ngView within a custom directive

I've been attempting to implement ng-view within a custom directive, but it doesn't seem to be functioning properly and I'm not receiving any console errors. Here's the code for my directive: (function() { 'use strict'; angular .module(' ...

Ensure that you provide distinct values for both the model and view in your input

Is there a way to automatically format the numbers I type with a $ symbol in the input field, without actually storing the $ in the model? I've tried different methods but so far, if there is already a value in the model (not null), it displays with $. How ...

Can someone help me figure out the issue with my Angularjs ng-repeat implementation?

After spending hours trying to figure out why something so simple is not working, I'm at a loss. Testing with a dummy list proves the functionality works, but when I connect my server-side data source, it fails. The JSON returned from the AJAX call is ide ...

Angular.js enables seamless synchronization between contenteditable elements and the $scope object by automatically updating the

I'm completely new to Angular.js and have been exploring various tutorials to grasp the concept of two-way binding with contenteditable elements within an ng-repeat. Currently, I am utilizing a shared 'store' between controllers like this: ...

Can you explain the "parameters" in the Function link such as scope, element, and attrs in AngularJS?

After diving into AngularJS for a few months, I've searched high and low on the web and in my AngularJS Directives guidebook to solve this mystery. Every time I come across directives, I see this particular block of code: link: function(scope, element, a ...

Sending an object over to a different page

Need some assistance with displaying JSON data that is being repeated using ng-repeat. { "title": "image title", "description": "Lorem ipsum dolor sit amet, per ea ferri platonem voluptaria, ea eum ubique ornatus interpretaris. Dolore erroribus reprimique ...

What is the best way to make ng-style append to a pre-existing style?

I am facing an issue with my custom popover directive and another custom directive that uses it. I am attempting to use ng-style to adjust the width of the popover. Below is a code snippet from the directive's html template: <div my-custom-popover ng-s ...

Discover the Power of AngularJS – Master the Art of Toggling Classes

Instructions scope.pauseClass = 'fa fa-pause'; scope.muteClass = 'fa fa-volume-on'; <button ng-click="doPlayOrPause(uniqId)"><i ng-class="pauseClass"></i></button> <button ng-click="doMute(uniqId)"><i ng-class="muteClass" ...

What is the best way to include variable child directives within a parent directive in AngularJS?

Exploring a New Angular Challenge In the current project I am engaged in, I am faced with a unique problem that requires an 'angular way' solution. Despite my best efforts, I seem to be hitting a roadblock every time I attempt to solve it. The main issue ...

Updating an element's HTML content from a template URL using AngularJS

Can someone help me figure out how to set the html of an element in my directive based on a dynamic template url? element.html('some url to a template html file'); rather than using element.html('<div>test</div>').show() ...

Strategies for extracting value from getCurrentUserSync in AngularJS

Can anyone help me retrieve this value from the Profile variable? I have been unsuccessful in my attempts to get it. When I check the data console.log(this.Profile), it displays the data shown in the image below: this.Profile = Auth.getCurrentUserSync(); ...

Unlocking the Secret: Effortless Transference of an AngularJS Scope Variable from Directive to Controller

Is there a simpler way to transfer an AngularJS scope variable from a directive to a controller? I've come across some complicated examples, but can't we directly access a controller from a directive and update one of its scope variables? ...

radio input not reflecting changes in the model

My custom directive is causing issues with updating the model when using input type=radio, although normal text types are working fine. What steps can I take to ensure that the model continues to update properly? app.directive('advformInput', f ...

I need help figuring out the right way to define the scope for ng-model within a directive

I found a straightforward directive to automate sliders: app.directive('slider', function() { return { restrict: 'AE', link: function(scope, element, attrs) { element.slider({ value: scope[attrs.ngModel], ...

Why isn't the nested intricate directive being executed?

After watching a tutorial on YouTube by John Lindquist from egghead.io, where he discussed directives as components and containers, I decided to implement a similar structure but with a more dynamic approach. In his example, it looked something like this ...

Ways to conceal the ng-click attribute within the document object model

I am diving into the world of AngularJS and trying to expand my knowledge. I've encountered a roadblock where I need to trigger a click event without using ng-click="myFunction()". Ideally, I want to keep the function being called hidden. <input t ...

Jasmine tests for AngularJS directive failed to invoke the link function

I can't figure out why the link function of my directive isn't being called in a Jasmine test. I've created a simple example to illustrate. Here is the code for my directive (TestDirective.js): 'use strict'; angular.module('comp-one').directive('test' ...

ng-repeat creating blank anchor links

I'm currently working on developing a navigation menu using AngularJS. Each menu item can have sub-items, which requires an additional ng-repeat directive to display the submenu items. However, I've encountered some unusual behavior when trying to include ...

Using AngularJS's "debounce" feature with ngBind

When using ngModel, you can specify options like ng-model-options="{ debounce: 1000 }" Is there a similar feature available for ngBind or {{}} ? I am currently binding data to a div element using ng-bind, and by default, Angular.js updates the div as so ...

Angular JS encountered an issue with executing 'removeChild' on 'Node' for HTMLScriptElement.callback, leading to an uncaught DOMException

I am currently using Angular's JSON HTTP call. When making a post request, I experience an error during runtime: Uncaught TypeError: Cannot read property 'parentElement' of undefined at checklistFunc (masterlowerlibs.67785a6….js:42972) checklistFunc ...

Developing a custom directive that utilizes a dynamic ng-options configuration

Alright, let me share with you my personalized directive: angular.module('bulwarkWebControls', []) .directive('customDropdown', [ function() { return { scope: { label: '@', // can be omitted changeCa ...

The ng-include feature seems to be malfunctioning

After building a basic web page using AngularJs, I ran into an issue when attempting to integrate header.htm into index.html - nothing was displaying in the browser. index.html <html> <script src="https://ajax.googleapis.com/ajax/libs/angul ...

The process of programmatically including ng-repeat within an element in an Angular directive

How can I add 'ng-repeat="n in counter"' to the 'form' tag inside my directive? I attempted to access the element via compile, but tElement.find('form') did not work as expected. You can view my code here: http://jsfiddle.net/fea40v2c/1/ I experimented w ...

Streamline repetitive scope attributes in AngularJS

After noticing that I was using a repetitive structure, I want to simplify it: <container> <clock property="data"></clock> <calendar property="data"></calendar> <alert property="data"></alert> </container ...

Compile an HTML template and initiate a printing operation only once the compilation process has finished

While working on a directive's link function, my goal is to insert a compiled ad-hoc template into the DIV of a document and then proceed to print the window. I attempted the code below, and although the printer preview shows up, the data in it is sti ...

How to trigger a function in a separate component (Comp2) from the HTML of Comp1 using Angular 2

--- Component 1--------------- <div> <li><a href="#" (click)="getFactsCount()"> Instance 2 </a></li> However, the getFactsCount() function is located in another component. I am considering utilizing @output/emitter or some o ...

The directives applied within ng-include are not functioning correctly

Below is a custom directive I have implemented. var fancySelectDirective = pluginDirecitvesModule.directive("custom-select",function(){ return { restrict: 'C', link: function (scope, element, attrs) { ele ...

Exploring the differences between $scope binding and $broadcast in managing an application timer

I'm a bit puzzled about the most effective way to bind the time value of a Timer service to multiple directives. There are two methods outlined below, and I'm uncertain about which one is considered best practice or if there are any performance b ...

Issues with the functionality of the directive's link feature

Today I am diving into the world of directives and came across the compile and link functions. However, I am encountering an issue with my link function that is not working as expected. Below is my code snippet: <body ng-app="myModule" ng-controller=" ...

Methods to Retrieve Data in Directive

Below is the directive I am working with: directive('checkKey', function() { return { restrict: 'A', scope: { min: '=' }, link: function(scope, elem, att ...

Error encountered when attempting to use the submit button in AngularJS

My goal is to create a simple Angular application that takes input of two numbers (n1 and n2) and then prints their sum. I have integrated Bootstrap for styling, but noticed that nothing was happening upon submission. To troubleshoot, I added an alert() fu ...

Submitted input in a text field is automatically displayed in a separate text box

Below is a snippet of HTML code from my AngularJS application <input type="text" class="input-xlarge" id="user_name" ng-model="myModel.text" name="user_name" rel="popover" data-content="Enter your first and last name." data-original-titl ...

`Need help setting the active class for a bootstrap navbar using Angular JS?`

In my bootstrap navbar, I have the following menu items: Home | About | Contact I'm looking to assign the active class to each menu item based on the current angular route. Specifically, how can I set class="active" when the angular route is at # ...

Unable to create module instance, despite correct module definition

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <script src="../angular/angular-1.6.7/angular.js"/> <script src="../angular/angular-1.6.7/angular-route.min.js"/> <!--script type="text/ja ...

Incorporate a directive dynamically within a separate directive

Introducing the table-div directive, which is responsible for rendering both the header and body of a table. Each row within tbody has the option to incorporate additional functionality through a custom directive that can display data linked to its parent ...

Implementing communication between directive and controller in AngularJS by updating the changed value

Typically, the sequence of execution is controller ---> directive, isn't it? Here's a scenario I have: In the controller, we set the default value for placeholder: $scope.formsDropDown = { show: true, placeholder: 'Select a Form&ap ...

Bizarre Angular directive nesting issue discovered after upgrading from version 1.4.9 to 1.5.0

Forgive the unclear title; I am still trying to pinpoint exactly what is causing issues after the upgrade. Could it be a problem with nested directives or template inconsistencies? (see sample images & links to CodePens below) Issue I have a basic o ...

AngularJS helps with formatting dates in a more organized manner

I'm looking for a directive in Angular that will allow the user to enter a date in the format 2/3/67 into an input field and have it automatically formatted as 02/03/1967. I've tried a few approaches on my own but haven't been successful. ...

What is the best approach for invoking two services using a single provider factory?

Welcome! I'm having a little trouble setting up a discussion platform where users can post and comment. I've created two REST services for this purpose, but it seems like the commenting functionality is not working as expected. Could anyone help me identif ...

AngularJS: The behavior of an element is altered when compiled with a different directive

Currently, I am encountering inconsistent behavior with a directive when I $compile the element containing the said directive. Specifically, I have a directive designed to validate whether a password matches another password field. The structure of this di ...

Using `ngIf` with a condition causes the original object to be lost in the `let` binding

Imagine I am keeping track of the user currently logged in using this approach. If the user is null, it means they are not logged in. When logged in, they can either be anonymous (without a name) or have a name. interface User { name?: string; } current ...

Endless scrolling dilemma

I came across an example of infinite scrolling and attempted to implement it myself. Despite correcting all the errors I could find, it still refuses to work. Below is the directive code: module.exports = /*@ngInject*/ function scrollDirective($rootScope ...

After clicking the create button in AngularJS, the ngModel values become empty

My form has been simplified by using ngRepeat to create the input fields. The attributes for each item are defined in my controller. Below is the code for the ModalCtrl: ... $scope.form = [ { label: 'First Name', fieldType: 'text', name ...

Unable to display images in the ngImgCrop upload preview modal screen

Currently, I am utilizing ngImgCrop to enable an upload preview and square crop feature for profile pictures. Unfortunately, I am experiencing issues where neither the image preview nor the cropping functionality are being displayed. 'use strict'; ...