Latest Angular.js Recipes

How to use <md-icon> in Angular Material?

I am very new to AngularJS and also to Angular Material. I was wondering how to use Material's icons, as this is not working:

<material-icon icon = "/img/icons/ic_access_time_24px.svg"> </material-icon> 

I guess there is a problem with the path...

Read the entire recipe Recipe added 41 minutes ago

How to set a boolean flag to collapse/expand a row with ng-repeat

I have this plunker code.

What I'm trying to do, is to display the gray box one time per row.

To achieve this, I thought to modify the partition filter in order to return a JSON to add it a new property by row to know if the gray box is expanded or...

Read the entire recipe Recipe added 1 hour, 36 minutes ago

Angular TypeError: Cannot read property &#39;then&#39; of undefined

I have a data service like this:

this.myFunction= function(callback) {
    var url = rootURL + "path1/path2/service.json";
    var promise = $http.get(url);
        return callback(payload); 

Read the entire recipe Recipe added 2 hours, 41 minutes ago

Where can I get Angular ui-grid selected items

Testing out Angular ui-grid (ng-grid v.3.0). Can not for the life of me find the selected row. I just want to grab the rows or even row ID of row when a user clicks it. Found the top comment here but I think this is outdated: Getting select rows from...

Read the entire recipe Recipe added 3 hours, 42 minutes ago

Group item detail using AngularJs ng-repeat

I would like to perform a group by function inside of an ng-repeat

Given the following data:

var items = [];
items.push({ id: 1, widgetId: 54, colorId: 45 });
items.push({ id: 2, widgetId: 54, colorId: 72 });
items.push({ id: 3, widgetId: 54,...

Read the entire recipe Recipe added 4 hours, 40 minutes ago

$q.all and nested promises

Have a question about synchronizing nested promises when using $q in Angular. Will the following code ensure that the entire chain of promises is waited for? Meaning will the nested calls to services that return promises be waited for in the $q.all...

Read the entire recipe Recipe added 5 hours, 41 minutes ago

angucomplete in a form

Can I make angucomplete item in an html form? (in angular.js of course)
What do I need to put in selectedobject?

Tried this code but it doesn't do what I need of course:

   <form class="form-horizontal" role="form" name="AddShareForm" novalidate...

Read the entire recipe Recipe added 6 hours, 42 minutes ago

AngularJS ui-router otherwise to state instead of url?

I am using AngularJS and ui-router and in my app.js. I have the following line:


However I do not want it to send the user to a URL but instead to a state:

            views: {

Read the entire recipe Recipe added 7 hours, 39 minutes ago

Waiting for $rootScope value to resolve in Angular before page load

So I'm running into this problem where I'm using ngView and I have a navigation bar that is static throughout like so:

<div ng-include="'views/nav.html'" ng-controller="NavCtrl"></div>
<div class="container-fluid" ng-view=""></div>

This nav.html,...

Read the entire recipe Recipe added 8 hours, 39 minutes ago

$timeout not working in angular.js

i am using $timeout in my controller but its not working!

app.controller("Friendsrequests",['$http','$log','$location','$timeout','$scope', function($http,$log,$location,$timeout,$scope){
//getting base url of application
this.baseUrl = function() {

Read the entire recipe Recipe added 9 hours, 37 minutes ago

Angularjs databinding between factory and view

I'm having some trouble with databinding in AngularJS. In short I'm trying to link a variable from my factory to my view (the $scope). The factory (in my full implementation) listens to specific broadcasts and updates the variable, and the view should...

Read the entire recipe Recipe added 10 hours, 43 minutes ago

AngularJS ng-bind needs to show variable + &quot;string&quot;

I've created an ng-bind element in my template, which displays a number rounded by one decimal. How do I add a % to the end of it, from within the ng-bind logic?

My code:

<span ng-bind="variable | number: 1" 

Read the entire recipe Recipe added 11 hours, 36 minutes ago

How can a json file read in Android using Ionic and AngularJS Frameworks?

I have a problem now regarding about the json that can't be read in my android..

the json file is where my data is act as an static database..

I can get it with my Desktop but when it come to my mobile it didn't show..

Here is my sample...

Read the entire recipe Recipe added 12 hours, 43 minutes ago

Slide down/up with ngAnimate?

I want to add simple slide done/up animation. As an example, if you go to Fiddle you can see left-side panel, where you can add external resources, Ajax requests and so on. If click on some of those you can see simple animated slide down effect. What...

Read the entire recipe Recipe added 13 hours, 39 minutes ago

ionic scroll stops working after some using

i'm developing a ionic i have this issue of ionic scrolling not working after a while. when running the app in a device the scrolling is working as it should.but after sometime scrolling stops working in other forms in my application....

Read the entire recipe Recipe added 14 hours, 36 minutes ago

Modal Using AngularJS not opening, getting TypeError: undefined is not a function

I'm trying to open a simple modal using Angular. I want it to open from an "About" link in my navbar. Here's the html:

            <div ng-controller = "ModalDemoCtrl">
            <script type="text/ng-template" id="myModalContent.html">

Read the entire recipe Recipe added 15 hours, 37 minutes ago

Difference between Session Storage, Local Storage and Cookies in AngularJS

I would like to dig down into Angular, and for that i would like to know the difference between Session Storage, Local Storage and Cookies.

Problem Questions ---

1) $windows.sessionStorage can be used to store user session but the problem with it...

Read the entire recipe Recipe added 16 hours, 43 minutes ago

Redirect state in angularjs

This is the state configuration:

    .module('grabhutApp', [...])
    .config(function ($stateProvider, $urlRouterProvider) {

            // ACCOUNT
            .state('account', {
                abstract: true,

Read the entire recipe Recipe added 17 hours, 39 minutes ago

How to update ngModel&#39;s $modelValue based on the $viewValue update by user input

Say I have the following directive:

myApp.directive('myDirective', function() {
    return {
        restrict: 'A',
        require: 'ngModel',
        scope: {
            ngModel: '='
        link: function(scope, elem, attrs,...

Read the entire recipe Recipe added 18 hours, 39 minutes ago

angular protractor: driver.wait and .then taking allScriptsTimeout time to return

I am trying to test an xmpp chat application, and having some difficulties testing the results of asynchronous operations. The test is trying to remove a contact from your roster (contact list), and driver.wait does not seem to be resolving when the...

Read the entire recipe Recipe added 19 hours, 39 minutes ago

angularjs $httpProvider interceptor documentation

I am new to angular (and programming), here is a seemingly simple question but I could not figure it out.

some tutorials suggests using $httpProvider.interceptors.push('interceptorName') to manipulate the http request and response.

I want to know...

Read the entire recipe Recipe added 20 hours, 38 minutes ago

Reload AngularJS Controller

I'm a newbie to angularjs.

My problem is that I have a User Controller for handling Login and Logout. I have also another controller to load a header menu for my site.

If the user logs in to the site my isAuthenticated variable is set to true. If...

Read the entire recipe Recipe added 21 hours, 36 minutes ago

Bootstrap button loading text with Angularjs

In a non-angular application that uses bootstrap and jquery, I can create buttons like this:

<button id="saveButton" data-loading-text="Please wait...">Save</button>

Then, when the button is clicked, I can set it to it's loading state like...

Read the entire recipe Recipe added 22 hours, 40 minutes ago

Set default value of select to null option

According to the Angular documentation, you can create a null option that is not part of your model. This allows you to have a descriptive option. I.E. in their example they have -- choose color --. How can I make the null option the default option? I...

Read the entire recipe Recipe added 23 hours, 37 minutes ago

How to test angular $cacheFactory?

I am using $resource in an angular service. I want to use my own custom cache based upon $cacheFactory, rather than the built-in $http cache, so that I can manipulate the cache when responses arrive back from my REST service.

I am having great...

Read the entire recipe Recipe added 1 day ago