FAQ Database Discussion Community


Inconsistent results when evaluating an empty array for ng-show and ng-class

javascript,angularjs,ng-class,ng-show
I am using a controller to load an array and then showing and hiding content based on whether the array is loaded or not. However, the value of the array evaluates differently for different instances of ng-show and ng-class. My service (where the array is updated) is: 'use strict'; angular.module('yeahdoneit')...

Angular : displaying elements in navbar after logged in

javascript,angularjs,binding,navbar,ng-show
I am fairly new to AngularJS and I am facing issues while trying to show the userInfo in my navbar and the Logout button but only once I'm logged in. 1) I am using ng-show to display the Logout button only when I'm logged in but this button appears in...

ng-show/ng-hide based on function call

ng-show,date-comparison,ng-hide
I'm trying to compare two dates in a controller function and returning true/false to ng-show and ng-hide based on the logic in the controller, but it is not working as expected, below is the plnkr for the same. Can someone please help me figure out what is the issue. http://plnkr.co/edit/CWvb1uy0PeYFb0Tf34rY?p=preview...

ng-show is not updating my view

angularjs,ng-show
I saw many of those issues on the Internet but none of them seems similar to what I did... Or maybe there is the same behavior but I don't know where it happens. On every site I went it seems that if you do a change of the model somehow...

Set required attribute for an input element if it's not hidden

angularjs,ng-show
I'm working on a dynamic form using angular.js. Inputs field <div ng-show="condition()"> <input type="text" name="field" required> </div> If condition() returns false, the input field won't be shown. But by clicking on a submit button, I'll get on chrome, the message: An invalid form control with name='field' is not focusable. Well,...

angularjs ng-show delay in showing div

angularjs,onchange,ng-show
I am fairly new to Angular. I have a file input <input type="file" id="sampleFile" onchange="angular.element(this).scope().vm.displaySelectedXml()" /> with a div below it: <div ng-hide="!vm.displayXml"> <div> xml file display goes here </div> </div> I got the onchange event handler from here. My controller js has the following function: function displaySelectedXml() { vm.displayXml...

ng-hide or ng-show does not work if its controlled from within a ng-repeat

angularjs,ng-repeat,ng-show,ng-hide
I am trying to hide the div if any of the buttons in the ng-repeat is clicked. However it doesn't seem to work, it leads me to think if ng-hide or ng-show won't work if it is controlled from within a ng-repeat? <div data-ng-hide="showChooseHardware"> <table class="table"> <tbody> <tr data-ng-repeat="hardware in...

Angular ng-show (or ng-if) not updating on value change

ng-show
I have a simple example at plunker. I have an ng-show on one element and a select as another element. The select should toggle showing/hiding the other (input) element. Initially setting the select to Yes shows the other input element as expected. Then setting the select to No does toggle...

Ng-repeat toggle, initial state shows first-child and hides the rest

javascript,angularjs,angularjs-ng-repeat,ng-show
I'm currently accomplishing toggling the visibility of items from a collection like so: .terms ng-repeat="term in terms" h1 ng-click="termOpen = !termOpen" | {{term.name}} .term ng-show="termOpen" p Content blah blah The default state of .term is hidden. When the heading is clicked the contents of .term are revealed. This works fine,...

AngularJS ng-hide ng-show or ng-if based on active state of array items

angularjs,ng-show
hi so i am building a shopping cart and it has 3 views menu,options,and order. The list is built using ng-repeat from json data. each item in the array as an active field set to false. when an item is added to the order its value is set to true....

Angular js ng-show doesn't work with native Math expression

javascript,angularjs,ng-show
This doesn't work (div never appears): <div ng-show="parseFloat(vehicle.pricing) > 1"> This DOES work: <div ng-show="vehicle.pricing > 1"> Why?...

Comparing two integers in AngularJS directive

javascript,angularjs,angularjs-directive,ng-show,angular-ng-if
I want to conditionally show or hide an element based on the associated User's graduation_year and the ng-show and ng-if directives aren't working as is. The element should be shown if the graduation_year is greater than or equal to the current year (i.e. the user is "active"), and hidden if...

Can't get ng-hide & ng-show to work with tokens

angularjs,token,jwt,ng-show,ng-hide
My problem is similar to this : ng-show and ng-hide with jwt Although i modified as instructed by user3735441, i still can't make them work properly: Service : 'use strict'; /** * @ngdoc service * @name ToDoManagerApp.authToken * @description * # authToken * Factory in the ToDoManagerApp. */ angular.module('ToDoManagerApp').factory('authToken', function($window)...

Angular ngShow is not removing tag style

javascript,angularjs,ng-show
This is my js: (function () { angular.module("profile.view", []) .controller("ViewController", ["$scope", function (scope) { scope.profile = {{ profile_json|raw }}; }]); angular.module("profileApp", ["profile.view"]); angular.bootstrap(document, ["profileApp"]); })(); and my html: <html> <body> <div class="loading" ng-if="false">Loading ....</div> <div ng-controller="ViewController" style="display: none" ng-show="true"> some text </div> </body> </html> Why angular is not removing "display:none"...

How to correctly watch for clicks outside an element?

javascript,angularjs,angularjs-ng-click,ng-show
When I click on "Add New Item" button I want a popup form to be displayed. Then if I click outside this form I want it to hide itself. To show/hide form I use ng-show directive. To watch for outside clicks I use third-party Angular directive angular-clickout But there is...

With angular, how do i call the result of a custom filter in a ng-show?

javascript,angularjs,filter,ng-repeat,ng-show
I have a dictionary with some datas. I'm filtering these datas with a custom filter which looks the current date and compares it with the date of the schedule. If the current date is between the dates of the schedule, it displays the schedules. My problem is I want to...

ng-show doesnt hide my element when value is set to false

javascript,angularjs,scope,ng-show
I am working on a web page that shows a certain piece of text and then hides it. The show part is working, the hide part is not: HTML <div ng-show="uploadComplete" class="col-sm-2 control-label">Upload Complete</div> Javascript $http.post('/rest/upload-data', {msg:'hello word!'}). success(function(data, status, headers, config) { console.log(data + " " + status) $scope.uploadInProgress...

Showing / hiding content based on route in Angular, only works after refresh

angularjs,angular-ui-router,ng-show
I have a header + footer I don't want to show on the landing (language) page. This works, but only after a refresh. What would be best practice to solve this? Here's what I've got: <div ng-include= " 'includes/header.html ' " ng-show="{{currentPage != '/language'}}"> Inside my LanguageCtrl there's $scope.currentPage =...

Angularjs Directive to slide show and hide content

javascript,angularjs,angularjs-directive,ng-show,ng-hide
I have used Slide up/down effect with ng-show and ng-animate as a base for my issue. However, the directive only allow for one element to be hidden/displayed. When there are 2, only the first shows: Here's a plunker: http://plnkr.co/edit/YtPgcUcnapiQfAR5hxiE?p=preview If you click on Link 2, it'll show the first content....

AngularJs animation for ng-show faster when showing than hiding

javascript,angularjs,transition,ng-animate,ng-show
I have an Angular (1.3.14) app (shown below) which is supposed to animate the ng-show when you click the link. I expect it to expand / contract at the same speed, but I cannot get it to work correctly. I also don't know why the height change is waiting until...