Latest Angular.js Recipes

How to get a fixed columnwidth with ngtable?

I am getting my head around the ngtable. Just one question, how can I make the columns fixed width? In this sample the account and adviser column have variable width when going to the next page. This is the html:

<table ng-table="tableParams"...

Read the entire recipe Recipe added 53 minutes ago

$sce:itype Attempted to trust a non-string value in a content requiring a string: Context: resourceUrl

I want to play songs stored in my sails server. Path is http://localhost:4000/images/123.mp3.

In front end, i'm using ng-repeat to list that songs from server.

 <div ng-repeat="tones in ringTones track by $index">
      <div>
        <i...

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

How to display Image received as byte array in Angular JS

I have a server side application that will return an image. These are the response headers:

Content-Disposition: attachment; filename=8822a009-944e-43f4-999b-d297198d302a;1.0_low-res
Content-Length: 502343
Content-Type: image/png
Date: Mon, 03 Aug...

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

Angular Material: full page tabs size

I am trying to occupy the space of the full page but I can't seem to get the height of the tabs right on angular-material 0.10.0, unless I add .ng-scope { height: 100%; }.

Is there a better way to achieve full page tabs?

Full test code: (and here)

...

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

Locating an element using ng-model using Selenium in python

I am trying to automate an AngularJS application using Selenium in python. I am trying to find an element with ng-modal. I have seen some post related to Java which specifies that you can use the following...

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

How to clear localstorage data in ionic?

Here is my code.

$scope.logout=function(){
    localstorage.set('user_id', "");
    localstorage.set('access-token', "");
    localstorage.set('isUserTraverseColony', 0);
    localstorage.set('isStarted', 0);
    $window.localStorage.clear();
   ...

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

Use ng-click on md-tab label

I'm having trouble with md-tabs : I can't call a controller function whenever I click on a specific tab to be displayed.

Here are the few codes I tried :

<md-tabs md-center-tabs id="menuTabs" md-dynamic-height="true" ng-click="focusSearch()">

     ...

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

What is md-item and md-item-content

I read and html file containing the md-item and md-item-content in a codepen, where it was used within a md-list. I could not find any documentation for it in the angular-material's references.

what does it actually do, is it not supported any more...

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

AngularJS increment value for id attributes

I have some html that looks like this:

<tr ng-repeat="x in y">
    <td>
         <div ng-attr-id="{{getId()}}"></div>
    </td>
    <td>
         <div ng-attr-id="{{getId()}}"></div>
    </td>
    <td>
         <div ng-attr-id="{{getId()}}"></div>
  ...

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

Converting local time into UTC time in angularjs

I am using var

date= new Date();

in my controller to get current local time. I am getting the output like this-

var date=Mon Aug 03 2015 07:56:55 GMT +0530(India Standard Time)

but i need UTC time. How to get UTC time in angularjs or convert...

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

Angular HTML5 mode with express

I know there are answers to this question, but they're not fully working for me. I'm using Angular 1.4 and Express 4. Express is handling API calls and Angular is supposed to be handling all HTML.

My express app.js:

var express =...

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

Angular-UI (bootstrap) popover not working?

So I'm working on getting a popover to show up on a button using Angular-UI. I tested out tooltips first and they're working perfectly...but when I use popovers it's not working at all.

My controller is empty, just has $scope. Here's my code for the...

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

how to pass MVC model to a UI-bootstrap modal

I am trying to use a Angular/bootstrap modal to edit MVC ApplicationUser scaffolded views. I have a found a few examples, they are mostly jquery. I found one that works well using jquery-ui. I want to be consistent with my modals so I need to make it...

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

AngularJS Service Jasmine Unit Test Unflushed Request Error

I'm writing my first unit test to check the functionality of a AngularJS service. This is the part of the service with the getList function I'm testing:

(function() {
'use strict';

angular
    .module('app.services')
    .factory('RestService',...

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

Angular Material mdTabs - how to get only the effect of tabs animation not the content?

I want to get the animation effect of when someone clicks on the tab and the border below that tab slides to right with the button having a nice ripple effect. I don't want to use the content inside the tab, I just want the tab effect.

mdTabs

As you can...

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

ng-focus is not working for input text in angularjs?

I want to use ng-focus for input text, It is not working but it gives old value, First time. I want to use the date field value in controller to create dynamic URL, It will fetch the JSON data corresponding date, So here I am creating dynamic URL...

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

Populating Ionic select with Data

Hi I want to populate my select tool with data which I am calling from a service. I am still new to Angularjs so this is a little difficult to figure out. If someone can refer an article or a piece of coding for me I would appreciate it.

NOTE: I am...

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

AngularJS Edit Data/Form

I'm looking to make a form on AngularJS to edit a database row accessed via a REST API. I have no problems accessing the data, what I really have an issue is configuring the form for editing. How would I be able to display the data and if the user...

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

Implement CKEditor with AngularJS (pasteState event)

I use CKEditor in my AngularJS webapp. I defined the event pasteState to listen to text changes and copy it to my ng-model.

Today, I upgraded CKEditor from version 4.4.7 to 4.5.1 (the last one) and discovered that my pasteState event is never...

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

HighCharts: How to use reflow to allow auto-resize after changing size

In our Angular app we're using highcarts-ng for our HighCharts implementation.

Here is the Chart Maximize and Minimize function, which works:

function expandChartPanel() {
    vm.chartMaxed = !vm.chartMaxed;

    viewHeader =...

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

AngularJS controller for a tab

I have three tabs in my page. I'm using tabset and tab according to Angular Bootstrap Docs.

I set a controller for the <div> which has the tabsetas

<div ng-controller="Tabs" class="panel panel-default" id="tabs-panel"> 
  <tabset ...

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

Protractor error Angular could not be found on the page

I'm trying to set up End-2-End testing for my Angular (1.4) site using protractor (2.1.0). Jasmine is installed and unit tests are working fine. When I run protractor the index#/login page loads in a browser window but no code runs and protractor...

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

AngularJS ng-repeat array of arrays

Is it possible to use ng-repeat with an array of arrays?

Here's my view:

<div ng-repeat="item in items">
  <p>{{item}}</p>
  <ul>
    <li ng-repeat="i in item.items">{{i}}</li>
  </ul>
</div>

Here's my controller:

  var app =...

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

Download MS Excel/Word via AngularJS call to a REST service

I have an AngularJS application that sends a POST request to a REST service (onClick method of a button). The POST request contains a JSON object with various settings. The REST service uses those settings to create a MS Word/Excel file.

At the...

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

Running angular from node.js server

I have following files -

1) index.html

2) app.js (angular controllers here)

3) routes.js (I'm trying to load index.html from here - listening on localhost :3000)

4) index.css

5) node_modules folder

routes.js :

var express =...

Read the entire recipe Recipe added 1 day ago