Search Posts

Category: angular1.6

Is it possible to interpolate a value to a class name with ng-class?

Is it possible to interpolate a value to a class name with ng-class ?? I’m not even sure whether it’s possible in angular1.6 ? So for example… <section id=“section-1”> <p class=“myclass-1”>help</p> </section> <section id=“section-2”> <p class=“myclass-2”>help</p> </section> <section id=“section-2”> <p class=“myclass-2”>help</p> </section> I tried the following which obviously doesn’t work.. <div ng-repeat=“item in $ctrl.somethings”> <section id=“section-{{$index}}”> <p ng-class=“{ ‘my class-{{index}}’: $ctrl.name===‘examplething’ && $index==={{index}} }”>help</p> </section> </div> Any help REALLY appreciated : ) Source: AngularJS

ng-option is replacing my default option

I am having a select tag as <select ng-model=”vm.fooModel” ng-options=”item.id as item.name for item in vm.fooOptions” > <option value=”none”>Select</option> </select> The issue is that when this is getting rendered angular 1.6 is removing my default option and adding an empty option <option value=”?” selected=”selected”></option> My initial model value for “vm.fooModel” is “none” . ̶T̶h̶i̶s̶ ̶w̶a̶s̶ ̶w̶o̶r̶k̶i̶n̶g̶ ̶f̶i̶n̶e̶ ̶i̶n̶ ̶a̶n̶g̶u̶l̶a̶r̶ ̶1̶.̶5̶ Source: AngularJS

How to initiate websocket connection when user logged in and unsubscribe them when logged out in Angularjs 1.x web app [on hold]

Currently, I am using Angularjs 1.5. I need to subscribe to websocket topics when user logged in and unsubscribe them when user logged out in angularjs.. And need to handle page refresh, subscribe to topics when user is already logged in. Not sure where to write this logic.. app.run(()=>{}) ? Source: AngularJS

Angular 1.x – How to display table with dynamic rows and columns

Aim – Display a dynamic table for both rows and columns as below – Dynamic Header – The fund codes are values for “name” from the json object array. Dynamic rows with values for Application, Redemption and Net JSON object : [ { name: ‘VBIF’, application: 1000, redemption: -200, netAppRed: 800 }, { name: ‘VCIF’, application: 1500, redemption: -200, netAppRed: 800 }, { name: ‘VMPF’, application: 2000, redemption: 0, netAppRed: 2000 }, { name: ‘VBIF-A’, […]

Ng-repeat one-time binding and "track by" change

Our web app uses ngRepeat to display a list of items. The array and its objects are never changed, but values of the objects inside can be modified by the user. We generate a unique trackId’s for each item. This trackId is updated every time the item’s values change. We are also using the one-time binding syntax to reduce the number of watchers on the page (as it can quickly climb to the thousands). However, […]

Angular.js (1.6.9) conditonally apply class using $eval

I am trying to use ng-class to apply conditional formatting within an ng-repeat. The condition should be based on evaluation of an object data string. I am trying to get his code to apply bold to the 3rd item. I have done my best at trying $eval or $parse to no avail. <body ng-app=”examsApp”> <div ng-controller=”ExamsController as examsList”> <div ng-repeat=”exam in examsList.exams”> <span ng-repeat=”levelnum in exam.levels.levelnums” ng-class=”{ ‘bold’: $eval(exam.levels.evalby[$index]) }”> {{levelnum}} </span> </div> </div> </body> […]

how to dynamically set title and description of angular single page application for google bot?

i want google bot to recognize titles and descriptions of my pages, the title and descriptions are coming from the database.. i used document.title = $scope.dataFetchedFromDB.title; and document.querySelector(“meta[name=’description’]”).content = $scope.dataFetchedFromDB.description; and it does change the title and description in the browser, but not in the snippets fetched by google or facebook or slack…. the old title and description remains. i know about ng-meta npm package, but i dont have my pages on static route, the […]

Next Page »