Latest Angular.js Recipes

Word wrapping in ng-grid header cells

I have a question regarding word-wrapping in ng-grid's header cells. I have tried adding

word-wrap: break-word !important; 

to a custom header cell template (as a style attribute on the ngCellText div), in the css for both the cellClass and...

Read the entire recipe Recipe added 32 minutes ago

tooltip-html-unsafe stopped working

I have a tooltip that displays an img - so I used tooltip-html-unsafe When upgrading to Angular 1.3 (or maybe earlier) it stopped working

  1. When trying to upgrade to 0.12 (I have 0.10) I get:
    angular#>=1 <1.3.0 which resolved to 1.2.27 and is required...

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

How to bind multiple JSON files in ng-repeat (AngularJS)?

I have multiple JSON files:

main.json:

{
  "MainRegister": [
    {
      "name": "Name1",
      "url": "url1.json",
    },
    {
      "name": "Name2",
      "url": "url2.json",
    },
 ]
}

url1.json

{
  "SubInformation": {
    "description":...

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

ionic responsive col for list item

Try to resize:http://codepen.io/anon/pen/zxGbbx

<ion-content>
  <ul class="list">
    <a class="item" ng-repeat="thread in data" ng-href="{{thread.url}}" target="_blank">
      <li class="">
        {{thread.title}}
        <span...

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

Form is undefined in scope in Angular 1.3

I don't if this is something I did, but once I upgraded to Angular 1.3, the form is no longer defined in my scope. My HTML is

<div some-dir>

    <form name="myForm">
    <!-- Form stuff here -->
    <button ng-click="submit();">
   ...

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

Angular-Material - Bug with Themes

I have recently stumbled upon Angular-Material. However It seems like the theme files are not being automatically included by the base angular-material.css file.

Therefor I must manually include every color theme that I would like to use...

If...

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

Nested objects and ng-models in Angular-JS

I am looking for solution for a problem which might not exist the way I am trying to do it. So if anyone can help me with the best way of doing this.

ISSUE:

I have the following input field:

 <input type="text" placeholder="quote"...

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

Angular Ctrl click?

How can I catch when user press Ctrl click ?

I can do it for single click using:

<input ng-click="some_function()"/>

but I need something like:

<input ng-CTRL-click="some_nice_function()"/>

Is that possible?

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

javascript does&#39;t convert angular ui datepicker date to UTC correctly

I'm using angular ui datepicker in my project(asp.net web api + angularjs). All works fine but when I'm trying to save date to Db it doesn't convert it to UTC format correctly and substructs 1 day(actually a few hours but it affects for a day too)....

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

Angularjs ui-router abstract state with resolve

Is it possible to make an abstract state with ui-router that needs to resolve data? I need to load the top half of a page with profile info, and then have a sub-nav that loads other details at the bottom of the page. The idea is that the abstract...

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

Saving the content of data into csv - AngularJS

Hi I'm trying to save the content of data which came from my webserver into csv file.

I'm trying this code which came from various question here in stackoverflow.

.success(function(data, status, headers, config) {
    console.log(data);
    if...

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

push if not exist in array object

I have the below model in JS . I am using angular js

$scope.data = {
            FocusOn: " ",
            Filters: [],
            Range: {
                From: "",
                To: ""
            }
        }

I have the below function...

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

Error $window.height is not a function - ngInfiniteScroll with angularjs

I'm trying to load data dynamically with ngInfiniteScroll and I'm having a problem where I'm getting $window.height is not a function.

Here's a fiddle, it's not quite working and I'm not sure why, the data doesn't display on the fiddle yet it does on...

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

How to convert Blob to File in JavaScript

I need to upload an image to NodeJS server to some directory. I am using connect-busboy node module for that.

I had the dataURL of the image that I converted to blob using the following code:

dataURLToBlob: function(dataURL) {
    var BASE64_MARKER...

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

AngularJS Inject factory into another factory from the same module

I'm trying to inject the factory Application into the ApplicationService factory. Both are defined in the same module.

Application factory (application.model.js)

(function(Object, coreModule) {
    'use strict';       

    // the factory to expose...

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

Using angular ui.layout in column mode - how to create a bottom aligned element

I just started to use angular ui-layout to allow splitting panes in a UI.

I'm trying to create a sidebar that has this blue element on the bottom

sidebar UI

Is there a way to trick the ui-layout directive to achieve this? I tried doing size, but that just...

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

angularjs foreach loop through http requests dependent on previous request

I want to loop through an array to perform $http.jsonp requests in angular, however each request will be slightly different depending on the timestamp of the previous $http.jsonp request. I'm trying to loop through 5 requests and each request is...

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

How to display JSON array using ng-repeat in angularjs?

This should be simple but I'm not able to solve this and have no idea where I am going wrong. I have an angular module that is supposed to repeat the data that is a JSON array; My controller and module looks like the one below

 (function() {

var...

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

Change class of just one element in an ngRepeat

I have an ng-repeat. And I would like to change the class of just that element vs the entire group.

<button ng-class="defaultClass" ng-repeat="tube in node.Tubes" ng-click="toggleBtn(tube)">{{"Tube " + ($index + 1)}}</button>

with the above HTML on...

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

Unit test angular directive updating the ngModel

I'm trying to test a directive that I've written to validate an input and I have some trouble. The input managed by the directive should contain a valid hex color value and if the user modifies it with an invalid value, I want to cancel this...

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

How to use checkbox with nested ng-repeat in angularjs

Hello everyone i have faced some problem in case of nested checkbox uses. In my problem i m stuck on to how to use IncludeAll on click checkbox. If checkbox value is true then it's give me a value of that. if IncludeAll checkbox is true then all...

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

Is it possible to give the size of the modal in the options

I am using bootstrap modal to show messages.

 var options = {
          backdrop: false,
          keyboard: true,
          backdropClick: false,
          templateUrl: 'a.html',
          controller: 'aController',  
        };
 var modalInstance =...

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

AngularJS add variable to scope problems

I am working on a more complex project(10000+ LoC) and during development I encountered a problem very often.

When I add a simple variable to scope like: $scope.editing = true;

   $sope.editing=false;

   $scope.changeTextButtonClicked = function()...

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

AngularJS - $http get returns error with status 0?

I've an AngularJS application in which I'm trying to get an XML data with $http get from a server say http://example.com/a/b/c/d/getDetails?fname=abc&lname=def (this when accessed manually by entering the link in a browser shows a tree structure of...

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

Static javascript variable to be used as counter in Angularjs controller

I would like to create a static javascript variable to be used as a counter inside a Angularjs controller. This static variable will be used inside a polling function that gets repeatedly called.

I want to use the static variable in a manner that...

Read the entire recipe Recipe added 1 day ago