ng-hide

AngularJS - hide/show div if date is within last 6 months

十年热恋 提交于 2020-12-08 02:20:52
问题 I have an ng-repeat that displays a list of dates, and information about purchases on that dates. HTML: <div ng-repeat="data in MyData"> <p> {{ data.purchasedOn.substring(6, data.purchasedOn.length - 2) | date:'dd/MM/yyyy' }} </p> <br> <p> {{ data.purchaseDescription }} </p> </div> Which displays: 01/02/2013 "Lorem ipsum dolor sit amet, consectetur adipisicing elit" 10/04/2014 "Lorem ipsum dolor sit amet, consectetur adipisicing elit" 02/08/2014 "Lorem ipsum dolor sit amet, consectetur

AngularJS: ng-show / ng-hide not working with `{{ }}` interpolation

大憨熊 提交于 2020-02-08 16:09:09
问题 I am trying to show / hide some HTML using the ng-show and ng-hide functions provided by AngularJS. According to the documentation, the respective usage for these functions are as follows: ngHide – {expression} - If the expression truthy then the element is shown or hidden respectively. ngShow – {expression} - If the expression is truthy then the element is shown or hidden respectively. This works for the following usecase: <p ng-hide="true">I'm hidden</p> <p ng-show="true">I'm shown</p>

Angular - Filter to remove blank strings from array

假如想象 提交于 2019-12-30 11:54:09
问题 I have an object of arrays... The array can contain blanks, how can i create an ANgular filter to remove the blanks to determine the length of the array? $scope.myData = { ["1", "1", "4", "4", "N", "4", "6", "8", "", "", "", "", "", "", "", "", "", "", ], ["2", "2", "4", "6", "0", "6", "5", "4", "2", "", "8", "", "", "", "", "", "", "", ], ["2", "3", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ], ["3", "F", "D", "3", "5", "1", "D", "5", "", "", "", "", "", "", "", "", "",

How to fade out element using ng-hide with AngularJS?

余生颓废 提交于 2019-12-22 13:49:18
问题 I can currently show/hide an element according to a boolean condition in my controller. How can I fade the element out if the condition is true instead of just instantly hiding it? <div id='conversion-image' ng-hide="pages.length > 0"> generating pages... <br /> <img src='Images/ajax-loader-blue.gif' /> </div> I also already have the ngAnimate dependancy included as well. var app = angular.module("app", ["ngAnimate"]); 回答1: You can do it with CSS and ng-animate as the following: .fade-out.ng

How can I use ng-hide if $location.url == base (root) url?

余生颓废 提交于 2019-12-20 22:56:13
问题 I'd like a ← Back to home link to appear below the nagivation on every page of my Angular app except the home page. So I'd like to conditionally add the link and hide it using ng-hide if the url is already on the home page (view) of the app. I've tried using angular's $location service with no success <p ng-hide="location.hash == '#/'" class="container"><a href="#topics">← Back to Home</a></p> I've tried the following variations: ng-hide="location.hash == '#/' " //console.log shows true ng

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

我只是一个虾纸丫 提交于 2019-12-13 02:34:26
问题 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 hardwares"> <td>{{hardware.name}}</td> <td> <button type="button" class="btn" data-ng-click="showChooseHardware=!showChooseHardware"/> </td> </tr> </tbody> </table> </div> 回答1: This is

Showing or hiding elements based on variables in controller - Ionic

ぐ巨炮叔叔 提交于 2019-12-12 14:06:19
问题 For all I know this might be more an AngularJS issue than an Ionic specific one. I have a button in one of my views: <button class="button button-clear button-block button-positive" ui-sref="register"> Register </button> And in my controller I have this variable that I get from local storage that is either true or false and has to be hidden depending that the value is: app.controller('loginController', ['$scope', '$localstorage', function($scope, $localstorage) { // Check if the user has

ng-show and ng-hide with jwt

北城余情 提交于 2019-12-11 13:44:13
问题 I'm managing authentication with JWT. I'm trying to use ng-hide and ng-show to show/hide login and logout buttons in my nav. It's not working. The token is being stored, but I'm unable to get the show/hide to work. Service: angular.module('psJwtApp') .factory('authToken', function ($window) { var storage = $window.localStorage; var cachedToken; var userToken = 'userToken'; var isAuthenticated = false; var authToken = { setToken: function (token) { cachedToken = token; storage.setItem

Use ng-show on a custom replace directive does not show or hide

纵饮孤独 提交于 2019-12-11 11:21:22
问题 I am having an issue with getting ng-show (or ng-hide) to work on a custom directive. It is working just fine on normal HTML elements. I made up a very simple example that shows the issue: <div ng-app="appMod"> <div ng-controller="Ctrl3"> <button>First</button> <button ng-hide="NoSecond">Second</button> <mybutton ng-hide="NoSecond" label="My button"/> </div> </div> and the JS: function Ctrl3($scope) { $scope.NoSecond = true; }; var appmod = angular.module('appMod', []); appmod.directive(

How to render maps within ng-hide divs using ngMap without getting a gray rectangle

我怕爱的太早我们不能终老 提交于 2019-12-11 01:11:32
问题 The problem: Google Maps elements that are within divs that are initially rendered as ng-hidden come up as gray rectangles when they are ng-shown. I've put together this Plunker to demonstrate: https://plnkr.co/edit/emzlIT?p=preview Others have had success using google.maps.event.trigger(map,'resize') , but for me it is no help, perhaps because I have multiple maps hidden. On this plunker, 'resize' seems to make a difference, but not consistently. If you play with the Plunker and everything