Latest Angular.js Recipes

Using ng-repeat on multiple arrays

I'm making a weather application but I'm stuck on what should be a simple task but I can't wrap my head around how this works since I'm new to Angular. Basically what I need is to iterate over two arrays at once and set some values from this...

Read the entire recipe Recipe added 40 minutes ago

Failed to load PDF document - Angular JS - BLOB

I am trying to get PDF document from Web API, and want to show in Angular App. Getting "Failed to load PDF document error". I have followed "AngularJS: Display blob (.pdf) in an angular app" post. Whereas, i can download the same file successfully...

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

Unable to make a $http.get request to a local JSON file using Angular

I'm making a weather application where I need to grab a local JSON file from within my controller and then do stuff with the data. However, I can't get a local $http.get request to work for some reason. What should I do?

This is my current code:

var...

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

Ionic Framework Twitter integration

I am presently working on a Project in which I have to use Ionic Framework for twitter integration.

I was using a sample program from ionic forum: http://forum.ionicframework.com/t/twitter-integration-with-jsoauth/3936

available at bitbucket: ...

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

How to set focus to div of TextAngular

I'm using a TextAngular.

<div
    text-angular
    ta-toolbar="[['bold','italics', 'underline', 'ol', 'ul']]"
    ng-model="model"></div>

I want to set focus by some condition, but I don't understand, how to do this.

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

AngularJS / Ionic routing using $stateProvider - controller is not reloading the second time a state is called

Original Question

I'm developing a mobile app using the Ionic Framework and AngularJS and I am having issues with controllers not reloading once they have been initialised.

One of the state transitions (from 'app.postbox-details' to...

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

Angular Calling Modal Open function from one controller to another

I have a Modal window in my header, with a Click event link in my header to open and close the Modal Window...and this works fine. I.e.

<div class="header" ng-controller="headerCtrl">
...
          <li><a href ng-click="open()">Report an...

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

AngularJS ng-disabled not working with list items

I am facing a problem with disabling a item in the list.

<div id="searchdropdown">
    <ul>
        <li>list1</li>
        <li ng-disabled="someCondition" ng-click="changeStatus()">list2</li>
        <li>list3</li>
    </ul>
</div>

It does not work...

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

Wait for async data before rendering a list on AngularJS and Ionic

I am a newbie on Angular JS but have good experience working with Javascript.

In my App I am creating a simple Factory fulfilled by JSON data coming from a web service:

.factory('Tools', function($http) { 
    var tools = {content:null};
    var...

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

ionic slide box not working with ng-repeat

i need to use a ionic slide box to show some images in my application. I used ionic slide box it does not seem to work with a ng-repeat.

this is my html part

<ion-view title="Promotions" ng-controller="PromotionsCtrl">


     <ion-content ...

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

How to use ng-repeat $index to find element in array

In my $scope, I have a property that's an array of cars appropriately name $scope.cars. User has ability to delete a car. I pass the $index (created by ng-repeat) of the car as a parameter to delete function deleteThis, however in JavaScript function...

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

How to run AngularJS on a web Server which invokes SQL Server Database Calls

I'm building my first Angular application with .NET.

I use VS 2012 and C# and SQL Server 2012.

I'm really excited about this but, despite the almost daunting amount of tutorials and docs available, I can't find a clear explanation of how to retrieve...

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

ng-repeat to access array inside of objects

I have an array with a list of objects. Each object also including an array (see below). I am using ng-repeat to iterate through the child array for each object, I tried many different way, but it just don't work at all. Any hint, direction, help...

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

Input value not visible in angularJS

This input value should be "Paris" but it does not display. What is wrong with my code?

(function(angular, undefined) {
  var mon_app = angular.module('mon_app', []);
  angular.module('mon_app').controller('monctrl', function($scope)...

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

Reject $http promise on success

I have a function that that returns a promise of an $http GET (the promise success/error is handled by the invoker). What I need is, given certain conditions and even though the $http is successful, to return an error (the invoker would catch this...

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

Angular JS generating PDF - any creator - maker modules?

As title says, is there any PDF creator / generator for Angular?

I have seen https://github.com/MrRio/jsPDF, but can't find any for Angular. I want to make an html page to a pdf file for download.

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

How to redirect on different view on refresh in AngularJS?

i'm developing an application in AngularJS. Basically, i have a "home" page and a "new project". In the home page i have a menu with a link to "new project".

I configured the $stateProvider as follows :

$stateProvider.state('home', {
    url: '/',
...

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

Parsing a CSV file provided by an input in Angular

I'm creating a webapp which features uploads of .csv file.

Instead of uploading the whole file on my server, then adding every lines in a table thanks to PHP, I'd like to parse the file in Angular, then add parsed lines (thanks to Restangular). This...

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

Protractor - count elements in repeater and print it

I'm trying to count the elements in repeater and to print it to console.

This is the markup:

<div class="col-md-3 ng-scope" ng-repeat="app in userApps" >...< /div> 

currently I'm counting and comparing:

expect(element.all(by.repeater('app in...

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

Angularjs ng-class not updating when using object annotation style

I just noticed that something doesn't work in Angular (or it doesn't as I expected it to work) when using object in ng-class.

What do I expect?

When changing the name of a property in the object, the class should update accordingly.

What did I...

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

Ionic framework vs Famo.us

What is the difference between Ionic Framework vs Famo.us Framework. It is possible to use both framework in one project . Which One support smooth render graphic on mobile devices ?

Both framework support AngularJs?

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

How to explain using browser.sleep in protractor

I'm a new to protractor,and I'm trying to test popover event, here is my code:

    describe('popover directive', function() {
        var buttons= element.all(by.tagName('button'));

        it('should show the popover title by clicking', function()...

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

Configure Amazon S3 static site with Angular JS ui.router html5Mode(true) on page refresh

How can I configure an Amazon S3 static webpage to properly route Angular ui.router html5Mode routes? On page refresh, it will make a request for a file that doesn't exist, and angular can't handle it. In the docs, they recommend changing your URL...

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

Angularjs - display current date and save it on a table

I got a view in angularjs and I'm just trying to display the current date.

html

 <input type="text" class="form-control" ng-model="lis.ModifiedDate" id="ModifiedDate">

app.js

$scope.ModifiedDate = $filter("ModifiedDate")(Date.now(),...

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

npm start returns error 127 while setting up angular-seed application

I am trying to setup angular-seed application.

I have installed nodejs with sudo apt-get install nodejs

Installed npm with sudo apt-get install npm

Installed bower with sudo apt-get install bower -g

Installed nodejs-legacy with sudo apt-get...

Read the entire recipe Recipe added 1 day ago