Questions tagged [angularjs]

64124 questions
1

votes
1

answer
1.2k

Views

ngModel reference when pushed into array

I am pushing a new order into the customer.orders array and everything works fine but it seems to reference the ngModel because if I now type something into the neworder.product model it updates the view at customer.orders.product. It seems to reset itself on refresh. Any ideas? Some Code: $scope.c...
Lorof
1

votes
1

answer
2.2k

Views

injecting service into angularjs app config

I am trying to inject $http serivce into app config, but getting "unknown provider $http error". woi.config(['$routeProvider', '$locationProvider','$http', function($routeProvider, $locationProvider,$http){ $routeProvider .when("/channels", { templateUrl: test, resolve: { app: function($http){...
Sanjay Salunkhe
1

votes
3

answer
55

Views

How can I add an array to an object but filter out all but one column for each array element?

I have an array on my page called answers that looks like this: answers[{x: 1, r: true;},{x: 2,r: false;},{x: 3, r: true;}] Hopefully I wrote this correctly. There are a variable number of rows in the answers array (this time it's three but it could be anything under ten). Each row contains an x fie...
Samantha J T Star
1

votes
1

answer
1.2k

Views

Prevent initial select option being blank in Angular

I have some simple angular code which renders a form and populates a select box with options from an array: html: Title: Created By: ... js: $scope.getUsers = function () { ConcernService.list('users/').then(function(data) { $scope.users = data; // assign user list to select options $scope.assigne...
Darwin Tech
1

votes
2

answer
2.6k

Views

Angular, ng-valid by default

I have an issue with the form validation, it is not performed at the form rendering As you can see in this plunker the form is valid by default (the checking is not run), but if you write something in the box and delete it, it starts working fine (the ok button is disabled). Does someone know how to...
IxDay
1

votes
2

answer
20.2k

Views

How to get the attribute of JSON object in javascript containing the '#' in the key [duplicate]

This question already has an answer here: How to access object properties containing special characters? 1 answer I have the JSON object returned by the api of last.fm as follow: { "artists": { "artist": { "name": "Daft Punk", "playcount": "494599", "listeners": "106101", "mbid": "056e4f3e-d505-4da...
zambliner
1

votes
2

answer
11.3k

Views

how to get href by ng-click a <a> in angular?

let us say we have a Click Here in the angular based application. $scope.myFunction= function(){ // how to get the href $http.get(href).success(function(data) { }) } the requirement is to click the and do a ajax request and get the json data from the server. since I choose to work on the angular,...
user824624
1

votes
3

answer
562

Views

AngularJS - dependency injection

I would like to know if there is a difference between the two next lines and why to use one of those (the two work as expected) phonecatApp.controller('PhoneListCtrl', function($scope, $http) {...}); phonecatApp.controller('PhoneListCtrl', ['$scope', '$http', function($scope, $http) {...}]); I took...
Jérome Pieret
1

votes
2

answer
5.3k

Views

$http response header message

is it possible in anulgarjs to fetch the response header message? in a code similar to that $http.get(url) .success(){ something }.error(status,"headers text message)"{ alert(status+" "+"headers text message or a method to get it"; } in the alert i need to write somthing like that: 500 internal serv...
mautrok
1

votes
2

answer
9.3k

Views

Loading dynamically pages into div using angularJS

I'm trying to load pages dynamically into a div using a select My HTML code : My JS code : $scope.showContent= function() { $scope.getView = function() { return $scope.selectedType.value ; } } I got this error : Error: [ng:areq] http://errors.angularjs.org/1.2.2/ng/areq?p0=Ctrl&p1=not%20a%20function...
Mils
1

votes
1

answer
604

Views

AngularJS - filter returning reference?

I was wondering if I do something like this in AngularJS, var myCat = cats.filter(function(comparedCat) { if(comparedCat.parentCategory != undefined) { return cat.id === comparedCat.parentCategory.id; } }); and it returns a list of objects [Object, Object, ...] Are these objects referenced to the th...
Mike
1

votes
1

answer
67

Views

form validations using a directive not working

i am new to angularJs.... i am trying to write a directive which wraps the input box inside a form tag and followed by a 'div' which includes validation. validation is not working. plunker link : PLUNKER i am wrapping the input tag using the following code var getHtml = function(){ return 'field i...
0

votes
0

answer
5

Views

NG1 UI-ROUTER: change parameter for controller and back to route

I have a state: $stateProvider .state('i18n.node', { url: '/node-{action:(?:search|add|edit)}/{key:.*}', params: { action: { value: 'search' }, key: { value: '', squash: true, raw: true } ... I need to replace a key / char with . for controller. It's not a problem, and I can do it like so: resolve:...
Kindzoku
1

votes
0

answer
10

Views

how to select multiple checkbox in angular 6

I m using checkbox in angular to select more than one option and im trying to get the value of check box in one object not in array.I have tried the following code. component.html file {{data.skill}} component.ts file formValue(){ this.myForm = this.fb.group({ VFields: this.fb.array([]) });...
Aakankshi Gupta
1

votes
1

answer
455

Views

Replicating string.format() of C# in JavaScript without numeric placeholders

String.Format method of C# allows you to keep "Replaces one or more format items in a specified string with the string representation of a specified object." string text = "select {0},{1},{2} from {3} where {4};" var result = String.Format(text, "col1","col2","col3","table","col1 > 10"); after this...
SharpCoder
1

votes
2

answer
4.8k

Views

AngularJS - radio button not updating model

First steps in AngularJS. I'm facing a strange problem related to this, but the solution doesn't work to me, maybe I'm missing something (as I said, I'm a really n00b with angular). I'm my HTML, I'm building some radio buttons like that: General Information > Knowledge About User {{option.text}} Se...
Sr.Richie
1

votes
1

answer
6.7k

Views

ngRoute not working. is there something i am doing wrong

Below is the code i am trying to execute but it is not routing to View1. in View1 i am just looping through each element of Simplecontroller. Please help. a var App = angular.module('App', ['ngRoute']); App.config(function ($routeProvider) { $routeProvider .when('/', { templ...
user3534506
1

votes
2

answer
820

Views

Angular.js with JsFiddle and dynamically changing a ng-controller value

I am trying to write my first angular.js application and not use jQuery. There are many REST calls each having its own ng-controller. I am trying to change the value of the ng-controller in the DIV declaration to output the different REST results. I have got the REST calls working and displaying the...
mcl
1

votes
1

answer
1.2k

Views

Passing a string containing HTML tags to a directive, tags not rendered

I'm passing a string to my angular directive. The problem here is that the string I'm passing contains some html, and obviously this is rendered as text in the directive output. I've been reading a lot, but all the solutions I can find (and also on Angular's docs) rely on using ng-bind-html directiv...
Sr.Richie
1

votes
1

answer
1.7k

Views

stop $location.path from refreshing the page

I know this issue has been discussed several times, found it myself on stackoverflow and on google groups, but can't figure out why my app is not working correctly. the thing is, i added reloadOnSearch: false, on the route, but still the page is refreshing. my app is set to work on $locationProvid...
Liad Livnat
1

votes
1

answer
642

Views

Event to know when content of a directive has changed

I'm creating a directive which position children div justify and with a margin = 0 changing the height of the children div. (like http://brunjo.github.io/rowGrid.js/) All is working well. Except when the children are changing. I have added a watch for the number of children so that if I add a child,...
Farf
1

votes
3

answer
754

Views

Creating reusable UI components

In jQuery, you can create reusable UI components. In AngularJS, I understand that using Directives is the equivalent way of doing this. The Directive syntax includes a Link property where you can manipulate the DOM. But this is where I get confused. AngularJS is meant to avoid manipulating the DOM b...
AndroidDev
1

votes
1

answer
1.3k

Views

Expressjs routes with Angular routes problems loading direct urls

I have angular working with expressjs and everything for the most part is working, however I am running into conflicts with routes in express and angular app.js app.get('/',routes.index); app.get('/about/:name', aboutRoutes.partials); app.get('/partials/:name', routes.partials); //authentication //a...
ThinkNewDev
1

votes
2

answer
55

Views

Is there any built-in AngularJS directive to control the visibility CSS property?

Is there something like ng-show but which controls the element's visibility style?
stackular
1

votes
1

answer
64

Views

GitHub API - Finding what languages does the repository is using

I am Using GitHub API to list all the public repository of the user. But now i want to see what language they use in the repository and call it through API. I did lot of research and looked into API but can't find anything around. Later i want to display this information into Graph. Please point me...
GeekOnGadgets
1

votes
1

answer
186

Views

Angular JS detach event handler

I'm looking for a way to release an event when linked on this way: angular.element($document[0].body).on('click', function (e) { // code }); Any clue?
Georges Legros
1

votes
2

answer
3.2k

Views

Angular.js $resource with ASP.Net webapi?

I have a simple ASP.Net WebAPI service that assigns a static variable on POST/PUT and returns the value on GET: private static State Repo = null; public State Get() { return Repo; } public void Post(State value) { Repo = value; } public void Put(State value) { Repo = value; } And I have an angular-r...
Sayak Banerjee
1

votes
2

answer
4.4k

Views

Reading nested array in JSON AngularJs using ng-repeat [closed]

I am developing an Android application using angularjs and ionic framework, using JSON to display some data in the application front end. I want to generate HTML like this: name1 name2 name3 Here is my JSON: var items=[ {name:["name1","name2","name3"]} ]; I can read the JSON node by myJsonO...
iam batman
1

votes
1

answer
1.1k

Views

Change angular model by filling a field form a previous locally stored value

I have a page with a select menu. I want to store that choice before moving to the search page. I can put the value in the search input, but it does not seem to be read by the angular search/filter. If I backspace once... or change the value in any way, it kicks in. How can I shove a value in there...
sheriffderek
1

votes
3

answer
1.8k

Views

How to call parent method from model controller

I have one controller named "contractController" contractController contains a method save() contractController opens one model window with controller named "PopUpcontroller" from PopUpcontroller i want to call save method on contractController tried to call save method like $parent but nothing work...
nidhin
1

votes
4

answer
285

Views

ng-show on click in AngularJS

I'm having trouble getting ng-show to work correctly when a user clicks an icon. The behaviour should be as follows: The parent div loads and shows some content. When the user clicks the play icon, the contents of the div become hidden. However, right now it doesn't seem to be working. See code belo...
dgalati54
1

votes
1

answer
2k

Views

Dynamic loading of controller + factory in angularjs

I am developing angularjs application that should be possible to extend with "addins". In the simplified case addin is just a pair of js+html files. Each addin should have one or more controllers and one or more factories. Below is an example of adding with one controller and one factory: JS: angula...
Amid
1

votes
2

answer
2.3k

Views

Angular Bootstrap alerts do not dismiss on a timeout

I am trying to add alerts from Angular Bootstrap and on timeout dismiss itself. However it does not dismiss itself. Here is the code: angular.module('ui.services').service('AlertService', [ function () { var alerts = []; this.add = function(type, msg){ var self = this; return alerts.push...
looneytunes
1

votes
1

answer
2.4k

Views

Angular ng If not working with razor syntax

I am using Angular Js with Razor. @{ var pageMode = (string) ViewBag.PageMode; } Greetings Value is in ViewBag.PageMode is "answer", still the ng if does not render. i.e "Greetings" message does not work. What am I doing wrong here... ?
Yasser
1

votes
1

answer
2.5k

Views

Angular UI Typeahead - Manually clear/hide dropdown

My use case is rather simple. I'm using the typeahead directive as a search box and want to manually clear/hide its dropdown when hitting enter (and you haven't selected anything) - much like Google does it. P.S. the text in my search box needs to remain intact when clearing the dropdown
Markus Coetzee
1

votes
1

answer
2.2k

Views

How can i get ng-change event in angular-ui-switch?

I'm using angular-ui-switch (https://www.npmjs.com/package/angular-ui-switch) as a toggle button. I'm wondering that how can i get change event on the switch.
Kishan Jobanputra
1

votes
3

answer
6k

Views

How to get button text with ng-model in angular.js?

I just started to work with Angular, it seems good to implement. I always use ng-model to get text from textfield. Can I get the button text with help of ng-model or something else? I know it's not good question to ask here. but I didn't get any relevant solution for anywhere. for example this is b...
abdulbarik
1

votes
1

answer
49

Views

What would be the best way to hide an element unless a different element has focus in AngularJS?

Basically, I have a search bar and predictions that show up below it. I want the predictions to be hidden unless the search bar has focus. There are lots of ways to implement this so I was wondering what do you think would be the best way to go about this and why?
magister94
1

votes
1

answer
784

Views

Customize chart tooltip as label with line pointing to pie segment

I am trying to get a chart that looks like this, but with value instead of percentage: Google Pie Chart Google Charts would work well, but as far as I can tell the closest you can get is the above with: legend.position = "labeled" But you cannot change percent to value. A straight line would be bett...
jeremyr
1

votes
3

answer
3.3k

Views

SignalR: webSockets timed out when trying to connect. Possible CORS issue

I am trying to write a mobile app (angular) that connects to an existing website that has a signalr hub. I have signalr configured on the web server: // Branch the pipeline here for requests that start with "/signalr" app.Map("/signalr", map => { // Setup the CORS middleware to run before SignalR. /...
coltech

View additional questions