The ngIf directive removes or recreates a portion of the DOM tree based on an {expression}. If the expression assigned to ngIf evaluates to a false value then the element is removed from the DOM, otherwise a clone of the element is reinserted into the DOM.

learn more… | top users | synonyms

0
votes
3answers
24 views

can we have ng-show and ng-if in one div tag?

Following code snippet does not work Please suggest any other way of doing it <html> `<div id="tablediv" ng-model="ngtable"> <div ng-show="ngtable"> <div ng-if="...
0
votes
0answers
45 views

angularjs ng-if cancel filter field on ng-repeat

I am usign nodeJS and i got a search input to filter a ng-repeat My input field is like this : : .form-group input.form-control( ng-model-options="{ debounce: 500 }" type="text" ng-model=...
0
votes
0answers
39 views

Watch a function and all its variables to use it in ngIf

I want to apply a ngIf directive to a DOM element, this ngIf watch a function and that function check the values of other variables. As the following: export class Controller{ private x: ...
-2
votes
2answers
41 views

Want 6 radio buttons in two line with 3 in each line

I have 6 radio buttons. I want 3 on one line and other 3 on another line. I am using ng-repeat for retrieving radio button data from json. I tried putting ng-if for placing it for even and odd but its ...
0
votes
0answers
36 views

display or hide loading from multiple controllers

I'm trying to create a generic loading that would be shared among controllers. So, I've created a service that will control the hide/show state: (function () { 'use strict'; var module = ...
0
votes
0answers
70 views

Ng-if doesn't work when contained in a String. How can I get it to work?

I have declared a variable called authenticated that I want to use to show or hide a button in a popover. The user should only see the button if he has already authenticated. I tried the ng-if with ...
4
votes
1answer
238 views

How make ngIf directive globally visible in all project?

I have a code <div class="flex-container" *ngIf="mail"> Some data </div> And i have a error Can't bind to 'ngIf' since it isn't a known property of 'div'. How i can fix it?
0
votes
2answers
139 views

Multiple ng-if on the same condition - performance wise

I have a html page with different element, that according to some condition (the same condition) will be shown/hidden using Angular's ng-if. In my controller, I create a boolean variable. $scope....
0
votes
2answers
150 views

Count ng-if true statements in angularjs?

I have a page which shows different data with ng-ifs, I need to show how many of them are true on the same page. Just the number. The HTML is complex, but I have made a simpler version to understand ...
0
votes
2answers
18 views

How to refactor this logic in the template/view to use a single line if statement (AngularJS 1.x)

I am fixing some small issues within our AngularJS application - I've come across the logic below which simply displays one link. In pseudocode style.. if (data.serviceId exists in the DOM) { ...
-1
votes
1answer
50 views

ngIf doesn't update with variable

I have a very simple ng-if construction using two MD buttons and one AngularJS scope variable isPlaying. However, the ng-if doesn't seem to work along with the variable. I can see the variable ...
0
votes
3answers
248 views

How to call a javascript function from ng-if outside of controller scope-AngularJS

I have a plain javascript function display(str) which I want to call inside ng-if. This function is outside the scope of controller HTML <body ng-app="myApp"> <div id="mycntrl" ng-...
0
votes
3answers
167 views

Angular ng-if not rendering div upon condition change

I'm working on learning Angular with Google maps and having difficulty rendering a map within a div controlled by an ng-if directive. For my application, I would like the map render upon receiving ...
1
vote
1answer
60 views

Remove <h1> with angular ng-if when go to specific route

I am new at JavaScript and AngularJS. I catch a problem. I want to remove h1 tag when go to /main route. I know that i must use ng-if and expression with $location at controller. <html> <...
0
votes
1answer
168 views

ng-if causes links to show for a second then disappear. How to prevent showing

ng-if sometimes causes links on my page to show during load time, and then disappear. The link is not supposed to show at all, and I am assuming that the ng-if statement hasn't been processed yet for ...
0
votes
0answers
161 views

Conditional ng-if cycle using http service - AngularJs - Json

I have a http service and with the code i have, i received 5 ids, but i would like to call the 5 ids using an if cycle in my controller. With the ids, in response2, i get 3 folders and 2 files, but i ...
0
votes
1answer
89 views

angularjs - ngswitch with 4 conditions

I need to write an angular ng-switch with 4 conditions. Some other answers here on SO suggest using ng-if instead of ng-switch. And so I tried with the ng-if, but I don't really think this is the ...
2
votes
2answers
54 views

Accessing DOM elements in directive after ng-if compiles

I am trying to build a side navigation menu, but want to dynamically populate its items based on the state of the DOM (i.e. <section>s in my DOM). However, I have some ng-ifs applied to various ...
0
votes
0answers
33 views

How to change the content of ng-table after checked checkbox

I have two category data which I would like display using ng-table directive through check checkbox. I tried to set variable in ng-checked field and use it by displaying ng-table using ng-if directive ...
0
votes
1answer
50 views

Angular ng-if clause not working both ways

I am displaying a json in a table, like so: <tr ng-repeat="room in allRooms | orderBy: 'OpenTime'"> Where allRooms contains json objects like this: { "Name": "Room five", "OpenTime": "...
0
votes
1answer
56 views

Order AngularJS directives are created not as I understand from the documentation

I have an AngularJS app where I have to traverse some of the elements with the cursor keys. To do this I created a directive called selectable that adds some info to a list in a service when the ...
0
votes
0answers
152 views

What's the right way to conditionally display forms in AngularJS

I am working on a little project that supports search filters. I have a default select dropdown from which a user can select e.g. Product Name, Status and Date. These options determine which type of ...
1
vote
1answer
256 views

Angularjs ng-if with ajax request

I'm new to angularjs and trying to figure out how to show/hide navbar elements depending on permissions. I'm currently getting the permissions via an ajax request: mycloudControllers.controller('...
1
vote
1answer
303 views

ng-if showing empty DOM element when condition is not true

I have the following in a view file: <p class="presentation black">Sections: <span data-ng-if="currentTab == 'tab1'"> <div ng-repeat="question in filtered = (template....
1
vote
2answers
929 views

how to Implement to check for null Date in angularJS using ng-if?

how to Implement to check for null Date in angularJS using ng-if ? The HTML Source Code is <!DOCTYPE html> <html> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/...
0
votes
1answer
70 views

ng-if inside ng-repeat always returning true

I am creating a table with data from the Premier League. I am trying to use ng-if to check if the home team won and if so add a cell saying "Home team won" HTML <div ng-if="data.full_time_result: ...
4
votes
1answer
39 views

Different renderings using ng-if?

I have a JSON feed which provides a list of search results - The list contains products and regular pages. When rendering the list, the products has a different rendering than the regular pages, which ...
0
votes
1answer
89 views

Can ng-repeat take user defined $index increment in Angular Js?

Pure HTML: <div class="table-tr museo_sans500"> <div class="table-td"><a href="javascript:void(0)">fgfbgfbfg</a></div> <div class="table-td"><a href="...
1
vote
2answers
4k views

How to use ng-if with tr tag along with ng-repeat?

Hi Can someone help me on this? Below is my code and the problem explanation. <table> <thead> <tr> <th>Icon</th> <th>Name</th> <th&...
0
votes
2answers
767 views

ng-if not working with ng-repeat

This should be a simple issue, but I don't understand what's happening. Basically I'm passing an object to a function call in my controller with ng-if withing an ng-repeat. However my function doesn'...
0
votes
0answers
86 views

I don't understand how ng-if work in a list

I don't understand how ng-if works: I would like that a button in a list is visible only if a condition is verified. In the example below, a button should only be visible if a list element has ...
0
votes
2answers
2k views

Test if a value exists in a map in a ng-if

How can I test if a value exists in a map in a ng-if? $scope.textInputTypes = { "currency": true, "double": true, "percent": true, "int": true, "email": true, "...
0
votes
1answer
128 views

AngularJS: ngIf and ngRepeat

I am using ngRepeat and ngIf to filter/sort(?) some data. I originally considered using ngSwitch instead of ngIf for this, but couldn't find a good example. After fumbling around with the slightly ...
1
vote
1answer
314 views

How to change text in this case using ng-if or other expression?

I'm trying to change the text in a title tag based on a tag's direction value: <li ng-repeat="t in tags"> <div class="tag" ng-class="{'green-up': t.direction == 'positive', ...
0
votes
1answer
90 views

How to put $last ngRepeat result out of href?

Is there any option to put $last ng-repeat result like this <li class="active">Four</li> instead of <li><a href="#">Four</a></li> ? I have been trying with ng-if ...
1
vote
1answer
47 views

do not include elements into ng-hide on form serialize

I gotta a single question, I'm using ng-show and ng-hide to display options on a form based on a select option, however, when I submit my controller looks like this: app.controller("MyCtrl", function(...