Latest Angular.js Recipes

angular ui-grid 3.0 get selected rows

This answer states that this code:

$scope.gridOptions.onRegisterApi = function(gridApi){

  $scope.gridApi = gridApi;

Should work in order to get the selected rows, but to me it...

Read the entire recipe Recipe added 37 minutes ago

Set form control to untouched on focus using AngularJS

In my form, I would like to set form controls as untouched when the user focuses on them in order to hide the validation messages which are displayed when the field is touched and invalid.

How can I do this?

I have tried writing a directive but have...

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

Is it possible to use Angular with the Jinja2 template engine?

I have a Flask site and I want to use the Angular JavaScript framework. Unfortunately, it seems as if the delimiters overlap.

How do I use Angular with Jinja2 if both rely on double curly braces ({{ expr }})? Is it even possible?

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

Cannot find bower packages

I installed Yeoman on snow leopard OSX 6.8. When I run 'grunt serve' I get the following error (it can't find my bower packages):

Dream-2:app1 goldenheart$ grunt serve
Running "serve" task

Running "clean:server" (clean) task
>> 1 path...

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

Angularjs - next input on keypress

I've been trying to implement a directive that watch everytime the user hit the keyboard.

I have four different inputs and each of them receives a single character and the user should fill the next form

I wrote a directive for this but it doesn't...

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

setting environment parameter for protractor e2e tests

We are using protractor to test our front end angular app that we are building.

Currently we are using browser.get() to specify our environement we wish to test again(localhost:9000, staging, UAT) however I am wanting to parameterize this so that...

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

How to detect bootstrap datetimepicker change events within angularJS

I am using this datetime picker in angular.

Inside of a controller I have:


In my HTML I have:

    <div id="#picker" >
        <input type='text'...

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

Angularjs bootstrap modal closing call when clicking outside/esc

I am using the Angular-ui/bootstrap modal in my project.

Here is my modal:

$scope.toggleModal = function () {
    $scope.theModal = ${
        animation: true,
        templateUrl: 'pages/templates/modal.html',
        size: "sm",

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

How to build dynamic controls in angular js using json?

I am working on a angular js project. Right now the controls are static. But client wants to create the html controls based on database.

I have a table with controls specification

For eg:

type : text/dropdown/radio/checkbox

events :...

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

Remove aggregation menu items from angularjs ui-grid menu

The ui-grid example on the official website ( ) presents a grouping feature, which looks like this: enter image description here

I would like to have the Grouping menu item, but not have the Aggregate ones (count, sum, max, min,...

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

I cant get the ionic autocomplete to work with

I am using guylabs/ion-autocomplete but facing some problems when running it in the ios and android emulator. Beforehand I made a mockup running it in the browser and this worked fine, but when copying the same code to my actual project I got an...

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

Cannot read property &#39;push&#39; of undefined Javascript

Hi it seams like i can't push my array ? code:

  $scope.arrResult = [];
  dpd.timesheets.get( function (result) {

    for (i = 0, n = result.length; i < n; i++) {
      var item = result[i];

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

Angularjs: filter items in ng-repeat containing a substring

So I have a scope variable which is set dynamically:

$scope.month = 'June'; //this will be a runtime assignment

And I have an array(example) which I have to iterate using ng-repeat:

$scope.dates = ['12 June, 2015', '12 April, 2015', '13 May, 2015'...

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

How to clear the data for a angular-chart

I have a nice application that displays a line chart based on several criteria. When the main criteria is changed I want to clear the current line chart. However, I cannot find out how to do this. I'm using AngulerJS v1.4.0-rc2, Chart.js v1.0.2 and...

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

Angularjs Show Image preview only if selected file is image

Here is my angular js code to show image preview when user select file

  <form action="<?php echo $this->getFormAction();?>" id="contactproForm" method="post" ng-app="myApp" ng-controller="myCtrl" enctype="multipart/form-data">


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

ui-router default child state not working

I'm testing UI-Router nested state, but I'm not able to set default state in parent/child scenario, please help.


  • angular 1.3.15
  • ui router: 0.2.15

navigation path:

/ - home
/settings - parent state/page
/settings.default - child...

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

how to trigger a function on window close using angularjs

I need to execute a function when the user closes the application, but the following points need to be considered :

  • I need to execute a function of one service, then...
  • ... an out-scoped pure-javascript based function is not likely to be useful...

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

Angular Click outside of an element in directive


ul {
   display: none
} {


<div ng-controller='exchangeFormCtr'>
    <div toggle-class="active">
           <li ng-repeat='carrency in carrencies'>

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

ng-include controller scope

I am having a problem in AngularJs when using ng-include to include an html template that has its own controller.

The problem in short is that I am able access scope variables defined in the controller of the included template in the template itself...

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

WebSocket Service update Scope in Angular (Using ngWebSocket)?

I'm trying to get data coming from a websocket to automatically update value inside a controller's scope.

My Service:

mimosaApp.service("Device", function ($websocket) {
    var self = this;
    var ws = $websocket.$new({
        url: "ws://" +...

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

How to delete row from table in angularjs

Now I need to delete row(s) depends on it is selected or not. But how can I access $index in the control for each selected row? my code is here:

  <div ng-app="appTable">
        <div ng-controller="Allocation">

            <button ng-click="add()">...

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

Angular random colors

I'm making a hacker news client app using angular.js and I want to display the story titles in random colors, however, my attempts haven't been successful.

here is the fiddle


for (var i = 0; i < stories.length; i++) {

    stories[i].color =...

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

Google map is not working directly into Angular App

Is it not possible to use Google Map directly in angular? I was using the common code in my angular app.

      #googleMap {
        width: 200px;
        height: 200px;
    <div id="googleMap"></div>

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

jQuery click events not working with AngularJS

I am in the process of converting my multipaged php + jquery website into a single page angular app. However I have written a lot of code with jquery already so only intend to swap the php for angular in regards to the routing etc.

One problem I...

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

Get value from Directive into Controller

So I have this filter directive:

app.directive('filter', function(){
  return {
    restrict: 'E',
    transclude: true,
    scope: {
        callFunc: '&'
            '   <div>' +
            '       <div ng-transclude></div>'...

Read the entire recipe Recipe added 1 day ago