In AngularJS, the ngInit directive allows you to evaluate an expression in the current scope.

learn more… | top users | synonyms

0
votes
0answers
26 views

init variable in ng-repeat's root scope

I want to know how can I initialize a variable in the ng-repeats root scope as I explained in the below block diagram. I should able to access the same variable in the filter that i am using as part. ...
0
votes
2answers
26 views

Passing value in function properly in AngularJS

I have the following function which takes variable description as parameter $scope.relsingle = function(description) { console.log(description); var url = $scope.url+'/api/descrelation?limit=...
0
votes
2answers
15 views

array variable in a div tag replicates in all the other div tags in angularJS

The array ar array in first #div1 is repeated in all the div. All other div have the common array variable name ar. I tried with different names. <body ng-app=""> <div id="div1" ng-...
0
votes
1answer
19 views

Assigning value to ng-init from Ajax result

I've a form with one input field to submit the student id via AJAX and I'm fetching some JSON result from the AJAX request. Now the returned data from AJAX request need to be assigned to ng-init in ...
0
votes
1answer
43 views

Angular variable initialized using ng-init is always undefined [duplicate]

I am learning Angular js. i am newbie to Angular js. Now I am initializing variable using ng-init. But the variable value is always undefined. Please see my code below. <!DOCTYPE html> <html ...
0
votes
1answer
20 views

I am using MVC 4 and angularjs in this actually I want to call an angular js function on page load

i want to invoke angularjs function (DeptSpecific) on page load and am passing ID as the parameter which is hard coded. And that i am passing via ng-init="DeptSpecific('1')". I am learning angularjs ...
1
vote
0answers
52 views

How can I set the first accordion item in the ngRepeat to be open while the rest are not?

I'm creating a list of tables with collapsible tbodys. This code works fine but I want to have the first tbody open on default. I've tried ng-init="showReports0" on the table tag, but this doesn't ...
0
votes
1answer
25 views

Context dictionary from Django template to Angular

I am building a web app and I want to know what is the best and the safest way to pass a variable from a django context dictionary to Angular. I have access to a variable of the context dictionary ...
1
vote
1answer
45 views

how to set $Index to 1 every ng-repeat call

<table class="table table-bordered"> <tr ng-repeat="x in AppliedJob"> <td>{{x.JobName}}</td> <td> <span class="dropdown" ng-repeat="y in AppliedCenter| ...
2
votes
2answers
47 views

Assign ng-model an object in a select

I'm iterating over a range and populating new select options for each index. The options are not related to the range I am iterating over but are options of different types. Code as follows: <div ...
0
votes
1answer
17 views

How do I stop the select from losing it's selected value after any event on the page occurs?

When the page is first loaded, the select binds to the correct value (calculated by ng-init) but as soon as any button is clicked on the page, the select loses its selected value. I'm new to angularJS....
5
votes
1answer
39 views

ng-repeat splice showing double

For some reason, when I splice an object into my ng-repeat array, it doubles what I splice in and hides the last object in the array. However, if I click the toggle hide and "refresh" the ng-repeat, ...
0
votes
1answer
134 views

Angular JS - declaring function inside ng-init?

I have few queries. Pls find them below - 1) A function defined inside an ng-init like given below ng-init='function a() {}' errors out. Changing the syntax to variable declaration type or ...
0
votes
1answer
38 views

Why variable initialization is required in ng-init: AngularJS

I have started leaning AngularJS. In AngularJS if we have to initialize an element lets take an example of select: <select id="s1" ng-model="vsrc" ng-init="vsrc='a.mp4'"> <option value="...
0
votes
0answers
59 views

AngularJS ng-init not working within ng-dialog

I have a page that opens with ng-dialog but the ng-init doesn't seem to be firing when I open it this way. Anyone have any ideas why?
0
votes
0answers
64 views

ng-init doesn't work in ionic collection-repeat block

I'm using the following view: <ion-item collection-repeat="scan in scans" href="#/app/scans/{{scan.local_id}}"> <h2 class="media-heading">ID: {{(scan.id ? scan.id : '--')}}</h2> ...
0
votes
1answer
72 views

Angular — ng-init scope variable not passing into view

I have the following in my index.html <header> <select ng-model="date.month" ng-init="currentMonth" ng-options="month for month in months"> </select> <select ng-...
2
votes
3answers
177 views

Expression in ng-init not working with ng-repeat

So I am trying to have many divs with background images and disable the background image when I hover over any particular div. <div id="interest" class="col-md-4 col-sm-6" ng-repeat="interest in ...
0
votes
1answer
254 views

How to select/init first value in html select option after data loads thru Angular 2 observable?

I have an html select with options that looks like this: <select [(ngModel)]="role" (ngModelChange)="roleChanged($event)"> <option *ngFor="#role of roles" [ngValue]="role">{{role.Name}...
0
votes
1answer
42 views

ng-init not working to inizialize data in combobox (angular)

I'm trying to initialize data in combobox, and I have tried every possible ways, but nothing: <select ng-init= "account.username = githubaccounts[0].username" data-ng-model="account" data-ng-...
0
votes
1answer
58 views

How to use ng-init with an object?

I have a dropdown whose value is an object. The html code is as follows. <div class="form-group"> <label>Goal<span class="red-ast">*</span></label><br /> ...
0
votes
0answers
23 views

ng-init doesn't run with ng-filter

I want to filter a list based on another list. So I want to display an item on the list_A only if it is in list_B. But this doesn't work. HTML <span ng-repeat="style_A in item.list_A | filter: ...
0
votes
2answers
119 views

ng-init is not setting my default category in my select within my Angular app

I have the exact same problem as mentioned here: How to have a default option in Angular.js select box However none of the answers fix my issue below, I'm trying to get the first category to show up ...
0
votes
0answers
218 views

Loading data with ng-init

I have a problem loading data in three dropdowns in my html with ngInit angular directive. I call the method initAll() in my controller from ng-init. This function loads the list of values for three ...
-4
votes
1answer
42 views

How can I get other http.get response inside in a ng-repeat

I have this HTML http://pastebin.com/DegTb0iH has a ng-repeat rulling in rullings within it need to do the vote count of each staff, get these values as follows: http://pastebin.com/EB4KigwS the ...
0
votes
4answers
186 views

Set ng-init value of select-controller with Angular using disabled options

I can't get this to work: <div class="year-divider"> <select style="width:70px;" class="form-control year-selector" id="{{'playerYearSelector'}}" name="...
1
vote
1answer
94 views

AngularJS - Initialize form data based on value

I am trying to add edit functionality to my app. In one view, I have a button that brings you to the edit page. <button ng-click="editMission(selectedMission.key)">Edit Mission</button> ...
0
votes
1answer
113 views

ng-init gives parse error when it finds u' in data received from Django

I am sending some data from the Django backend to the template, where I use Angular with ng-repeat and ng-init to loop through the data and print it on screen. This is how I get the data in the ...
1
vote
2answers
795 views

AngularJS ng-init is not working in ng-repeat

I need a Sum of Balance from the Following Data in HTML not in JS Controller Function. So, I used the ng-init within the ng-repeat. But I can't able to get the result. My JSON Data is { "records":...
0
votes
1answer
53 views

How to use ng-init to select a default value in a select box when the ng-model and the ng-options are referencing different objects

I have a select box that iterates over listOfThings, and the model has a currentThing property. The select box binds to currentThing correctly. However, I can't get the ng-init to set the default ...
0
votes
2answers
233 views

How to access ng-init variables using div DOM element?

in the below code, variables are defined using ng-init directive, angular expression gives the access to those variables, <body ng-app=""> <div ng-init="arr = [1, 2, 3, 4];obj={x:...
0
votes
1answer
269 views

Why $http in ng-init is not getting called everytime the view is loaded - AngularJS

I have modified my question as per my observation.$http request on server side is not happening whenever the view is called second or third or so on times although initWishList (ng-init) is getting ...
0
votes
0answers
139 views

Trigger ng-init manually

I have a profile with a series of cards. Each card has a type (e.g. gallery card, quote card, etc) and the profile can have 1 or more of each type. I'm building a profile editor and want to be able to ...
1
vote
2answers
2k views

AngularJs assign http response object to scope from html

This is the first time I use AngularJs and I would really appreciate some help on this. I have a json file from which I am retrieving some content that gets displayed on my html template. So far so ...
1
vote
1answer
33 views

ng-init not working with sails.get(“/..”)

I am trying to use ng-init to initialize values for each item in my ng-repeat. Each ng-repeat iteration calls a method which then does a sails.get call to get info from the db about the specific item, ...
1
vote
1answer
70 views

AngularJS: array[ {{value}} ] causes a parse error that I want to ignore

I have a selection list that I get from the controller, written like this: <select class="input form-control" id="animationTime" ng-options="item as item.label for item in aniCon....
0
votes
0answers
129 views

pass video source to other element's ng-init in angularjs

How can i can pass my video source(srcVideo) to ng-init in videoDetailsform.VideoUrl? Video.html <input ng-model="videoDetailsform.title" class="form-control input-default" ng-modal="form....
0
votes
1answer
193 views

Calling initialization function inside ng-repeat

I am trying to call ng-init function inside ng-repeat and it only works only on the first element: <li ng-repeat="comment in ad.comments|limitTo:quantity | orderBy : sortComment : true"> ...
0
votes
1answer
1k views

Calling a init function when a directive is loaded

I have a simple directive that loads comments from a service(commentsService): 'use strict'; angular.module('mean.rank') .directive('commentList', function(CommentsService, Global) { ...
2
votes
3answers
1k views

Inject variables via ng-init to controller

I want to inject the same variables with different values multiples times to the same controller. This is what I tried. What is a way to get different values in each call? HTML <body ng-app="...
2
votes
2answers
144 views

Set selected value of select menus

I have three select menu that bind to each other and want to set selected value of two select menus. Value that I want to set comes with scope. I try ng-init but that didn't work. Working Plunker <...
0
votes
1answer
1k views

Initializing variables that dynamically created inside ng-repeat

I need to create variables dynamically inside ng-repeat and initialize it using ng-init. <div data-ng-repeat="r in ['first','second','third']" data-ng-init="{{'panel'+$index}}=true"> {{'...
1
vote
2answers
75 views

Ng-init from an ng-repeat

I have a list of products, you can see the JSON : var panier = { "Client": "Ben", "Date":"", "Produits": [ { "Id": "188", "...
1
vote
2answers
222 views

change ng-init value when previous url is different

I want to change the ng-init = "tab=1" to ng-init = "tab=2" when I load current page from a specified page: http://191armyband.com/career.html. Is this possible by using a conditional function using ...
0
votes
1answer
150 views

ng-show does not react to $scope.apply

I have the following markup: <div class="liveResults"> <div><img ng-show="home!==undefined" ng-src="{{homeImg}}"> </div> <div>0:0</div> <div><img ng-...
0
votes
0answers
207 views

ng-init not working with angular ui routing

I am trying to call a function on a page load using ng-init .I have used ng-init in my layout page of ui-router. It is called only once. so when I move on to other pages it doesn't call the function ...
0
votes
1answer
71 views

AngularJS - Passing JSON data to Angular module

How to pass a JSON data to Angular module. This is my code <div ng-init="init({{post.name}})">
0
votes
0answers
52 views

angularjs don't want to get init date i think, pls help me

And i can't load data from $scope.positions = Position.query(); to be specific, on console it isn't loading anyway, so i don't know why it is like this. It looks like the ng-init cause for checking I'...
1
vote
1answer
615 views

Can you ng-init the value of ng-model based on other values on the scope?

I'm trying to calculate 2 values that the user typed in and set that result as the ng-model for another value. However I can't seem to get this code to work. <input type="number" ng-model="a">...
0
votes
1answer
107 views

AngularJS Undefined Variables When Trying To Update View From Controller

I am new to AngularJS and am trying to rewrite my webpage in the "angular way" instead of using jquery but I am running into some problems with my understanding. I have my HTML like so: <body ...