Latest Angular.js Recipes

x-access-token not intercepting in angular.js

When i use chrome extension called POSTMAN to call an api

api.get('/me', function(req, res) {
    res.json(req.decoded);
});

return api;

Using x-access-token as a header with a valid token value, i get a valid respond.

When using interceptor i...

Read the entire recipe Recipe added 58 minutes ago

Simple canvas in angularjs directive

I'm stuck (probably on some dumb mistake) trying to make a directive work with a canvas.

When I execute my code I get an element.getContext is not a functionwhich seems weird as my element is actually an HTMLCanvasElement.

This is my...

Read the entire recipe Recipe added 2 hours ago

Is `webdriver-manager start` necessary?

I'm delving into the world of Protractor tests for AngularJS.

All the tutorials recommend I execute the following after webdriver-manager update and prior to executing the test: webdriver-manager start

According to the webdriver-manager man, the...

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

How to decorate current state resolve function in UI-Router? Current function isn't invoked

I'm trying to DRY in $stateProvider and prevent adding the same auth function in each resolve. I've created decorator that in each state change would add this function to current state, but auth function isn't invoked, How to fix it or how to...

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

Store JSON data into a Variable

Hi Guys I am new to AngularJS started working on it just from 15 days I just want to load the JSON file data into a variable that is located in factory. Can anyone help me regarding this my code us here.

myApp.factory('quizFactory', function () {
var...

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

In angularjs we are having ng-disabled directive, why ng-enabled directive is not provided by the framework as we are having ng-show and ng-hide

In AngularJs ng-enabled directive is not provided. Is there any proper reason to not providing that directive in the framework, because we are having both ng-show and ng-hide when you can just use ng-hide to achieve our goal.

It wouldn't be nice just...

Read the entire recipe Recipe added 6 hours ago

angularjs .then() doesn't work (then is not a function)

I have a little problem developing a simple GUI for a game idea using AngularJS (v1.3.15) and Angular-Route. Anyway, for the registration, i want to pre-check the availability for the username while being typed. I set up a $watch, call the factory...

Read the entire recipe Recipe added 7 hours ago

How to easily make ionic tabs navigation

As I recently started working with "ionic", I am facing a problem making a "tabs navigation".

I was following a simple tutorial, I made a navigation with two tabs, but I couldn't make three tabs, it doesn't work properly, I'm afraid I didn't...

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

Angular & Ionic, HTTP Get not working in real device IOS

I have problem in my app , when I run the app in local host it's working without problem and I can see the channel list but when I try to test the app by physical device it doesn't show anything. I think the problem comes from the method that I'm...

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

In angularjs, how to set focus on input on form submit if input has error?

This is my code and I want to set focus on first name textbox on form submit if first name textbox has error like $error.required,$error.pattern,$error.minlength or $error.maxlength.

<form class="form-horizontal" name="clientForm" id="clientForm"...

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

Angular UI Bootstrap: Set timepicker to be empty by default

I'm using the Angular UI Bootstrap (https://angular-ui.github.io/bootstrap/) and specifically I am trying to use the timepicker, and though most components have every setting available that you would want, I have not figured out a way to get the...

Read the entire recipe Recipe added 11 hours ago

delete object property with angularjs

So i'm working on a project with angularjs.the goal of my project is to make a dynamic json generator with angular.i made a first version it works.But,there is a litlle problem with my app.when the user enters something ,the input is automatically...

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

Ionic, striped tabs header, should not slide to content on click

I'm kinda new to angularJs and Ionic. I have implemented striped tabs following the css documentation of ionic's website.

Striped tabs

I would like when i click on a tab that the header doesn't slide (reload) with its content.

Basicaly i need to do something...

Read the entire recipe Recipe added 13 hours ago

How to format a number value in AngularJS ui-grid cell to two decimal?

I'm using Angularjs ui-grid and using the default settings, the question is how can I format the numbers to two decimal?

enter image description here

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

Integrating timepicker into Ionic app

I am playing around with timepickers for an ionic app and am trying to integrate the below into an app

http://codepen.io/mnpenner/pen/mFokd

So I copied the code from above and put the js code into a controller and when you click on the input field...

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

Using $rootscope to change ng-show between controllers

What I want to do is pretty simple. I have two forms. One form is visible in the beginning and once that form is submitted it dissappears and the second form appears. I am trying to use a flag variable set at $rootscope.showFlag but it doesn't seem to...

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

How to add strped tabs on Ionic css

I'm new to ionic framework, and I start to play with and I like, so I decided to make a new application.

I'm facing a problem with adding a striped tabs on the top. the striped tabs are not positined in the top. see attached image :

enter image description here

here is my...

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

How to get attribute value in template in angularjs custom directive?

I am trying to get the attributes of "abc" defined as custom directive in angularjs:

<div abc="user">
    Access granted!
</div>

and then change the text inside div using custom directive:

.directive('abc', function() {
  var attr;
  return {
   ...

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

Evaluation of boolean expressions in AngularJS

I'm testing the ng-show and AngularJS expressions, but I found something I can't understand. I created a variable displayed and assigned a string 'false' (not boolean) to it. The expression displayed && true is evaluated to true, and the second div is...

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

Disable and Enable Hover in AngularJS

I want to enable and disable hover state on element on some condition. Very new to angular so don't know how to approach towards it. Also didn't find a solution on web.

Dummy CSS Code:

xyz{
   background:#2f9bdb;
}

xyz:hover{
  ...

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

List with ng-if in angular.js

I'm trying to use ng-if in angular.js. I have a json file:

"data":[{
   "status":"true",
   "name":"blabla",
   "group":true,
   "group_id":"123gr",
   "id":"xx1"
},{
   "status":"true",
   "name":"blabla2",
   "group":false,
   "id":"123gr",
  ...

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

jQuery Swiper script to run after Ng-Repeat elements are loaded

I'm making a web app using AngularJS, jQuery, HTML, CSS and Bootstrap, and I would like to pick some image links from my JSON that is located in an Apache2 server and use them in order to render those images in my main page. I would also like to swipe...

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

Angular remove item from json

I have a list in which when i click over an item i generate an input text and i add the attributes of that input in a json. Actually if i click over an item of the list for more times it adds at json all of that times i click. For example, if i click...

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

Test if an object is an empty object in a AngularJS template

I have a simple object in a controller which can sometimes be empty ({}).

app.controller('TestController', function() {
  var vm = this;

  vm.testObject = {};
});

I want to hide or show some DOM-elements in the corresponding template when the...

Read the entire recipe Recipe added 1 day ago

angular ui-grid 3.0 get selected rows

This answer states that this code:

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

  $scope.gridApi = gridApi;
  $scope.mySelectedRows=$scope.gridApi.selection.getSelectedRows();
}

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

Read the entire recipe Recipe added 1 day ago