Latest Angular.js Recipes

AngularJS With Asp.net Web API: $http post returning XMLHttpRequest cannot load: Response for preflight has invalid HTTP status code 405

When trying to POST json to Asp.net web api server using $http its returning the following error

XMLHttpRequest cannot load http://localhost:62158/api/video/add. Response for preflight has invalid HTTP status code 405

but making the same...

Read the entire recipe Recipe added 43 minutes ago

How to use image as button in ionic

My objective is to use image as a button in ionic. I first used a-tag to link between page. But when I clicked on the image. There is no button activated effect. So I switch to button-tag

I have tried using

<button class="button button-clear"...

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

About iOS IPv6 network with ionic framework

Yesterday, I submit my app for review, but I got a message from apple.

Apps are reviewed on an IPv6 network. Please ensure that your app supports IPv6 networks, as IPv6 compatibility is required.

For additional information about supporting...

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

angular ajax: Unexpected token I in JSON at position 0

I'm trying to sent html as json in http post request. But when I'm trying to make $http.post request, I've got the following error:

angular.js:12783 SyntaxError: Unexpected token I in JSON at position 0
    at Object.parse (native)
    at fromJson...

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

ngDialog - how to close dialog from the template (i.e. no controller functions)?

On ngDialog (https://github.com/likeastore/ngDialog), is there a built in way to close a dialog from within the template it self? I.e. so I don't need any functions in the controller calling the dialog?

This is my template (errorPopup.html):

<div>
 ...

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

How to get device id in ionic by using cordova plugin?

I am working on a hybrid ionic app.

I want to get the device id of a android device. I installed cordova plugin, included cordova.min.js file.

I tried by this code, still not displaying anything.

Is there any other way to get device id?

...

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

Angular 2 giving an error Uncaught SyntaxError: Unexpected token &lt;

I am trying to run angular 2 on my existing project and I've following codes :

<script src="https://code.angularjs.org/2.0.0-beta.0/angular2-polyfills.js"></script>
<script src="https://code.angularjs.org/tools/system.js"></script>
<script...

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

Angular 2 issue: typings: command not found

So this might come off as a really basic question but it has been bugging me for days now and haven't actually found a solution.

I'm installing typings from the command line with npm and it appears to run well but then I type any typing command and...

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

Attribute property binding for background-image url in Angular 2

I have been struggling to figure out the best way to dynamically change the background-image attribute in a number of Angular 2 components.

In the following example, I am attempting to set the background-image of a div to an @Input value using...

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

Angular 2 bind input to function call

Is it acceptable to bind @Input() property of child component to a function call of parent component, for example:

<navigation 
        [hasNextCategory]="hasNextCategory()"
        [hasPreviousCategory]="hasPreviousCategory()"
       ...

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

how to use underscore.js library in angular 2

I trying to create an application with angular 2,and want use underscore.js library in my .ts files ,for example when i want use this function :

   let myId = _.rest([5, 4, 3, 2, 1]);

_ is not define and throw error and i dont want use declare...

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

Ionic 1 AngularJs 1 vs Ionic 2 AngularJs 2?

I want to move from IOS to Ionic. But i don't have any idea that which version is best for starting, because i did't know nothing about AngularJs 1 and its update version AngularJs 2 features and differences. And also i did't find any related help...

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

Angular CLi&#39;s &quot;ng build&quot; doesn&#39;t produce a working project?

(I'm new on planet Angular2 (emigrated from dying planet
Flex/Actionscript, so please forgive this naive question)

Have I made a fatal error in thinking that after running the "ng build" command on my project from Angular CLi, I would end up with a...

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

Set default toggle to be checked in ion-toggle

Below is the code to list toggle buttons in which I want to set the first toggle button to be on and the rest off..

<ion-view view-title="Choose language">
  <ion-content>
    <div class="list"> 
      <ion-toggle ng-repeat="item in lists"...

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

AngularJS: Module &#39;App&#39; is not available! You either misspelled the module name or forgot to load it

i'm developing a simple web application using angularJS and i'm running into this issue i cannot resolve. Running my website i get this error in console:

Uncaught Error: [$injector:modulerr] Failed to instantiate module App due to: Error:...

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

How to set maximum length in input type=number?

I have a text field.

<input type="number" min="0" max="999">

But i am able to type as many numbers inside the text box.

As I set max=999, I don't want that to happen. Anyone knows the solution for this? I have tried ng-maxlength and maxlength but...

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

.css() is not a function [jQuery]?

I have the following custom tag/directive :

<tile class="ng-scope gridster-item" tilevalue="1" gridster-item="tile" row="0" col = "0" ng-repeat="tile in selectedTiles"> </tile>

I've created a keyboard control where the goal is to focus on each tile...

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

How to return data from promise

I need to get the response.data out of the promise so it can be returned by the enclosing function. I know I probably can't do it the way I've coded it because of normal javascript scope. Is there any way it can be done?

The console.log at #1...

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

$state.go is not a function

I'm doing a web app with AngularJs and I'm using $state to travel into the app. After the login, I want to go to the home (state 'app.dashboard.home' of the absolute state 'app.dashboard).

In this page, there is a button to go in another view called...

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

What is the equivalent of a factory in Angular2?

So I am used to using factories & services in Angular.

I am reading through the Angular2 docs and I don't see any equivalent of a factory. What is the equivalent for Angular2?

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

Angular2 reflect-metadata shim is required when using class decorators

I’m trying to use the universal starter example to learn more about server rendering with Angular2, I want to use gulp instead of webpack. The problem is when the server start I have :...

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

ionic display fullscreen image on click

i am building a mobile app using Ionic. Created a layout similar to this -- Card Layout

How to show the card image on full screen when the image gets clicked by user and back to normal when clicked again.

Plese find the exisitng code...

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

how to pass route params in [routerLink] angular 2

I'm trying to create an application with angular 2,And Want pass params to tag a in [routerLink],i want craete a link like this :

<a href="/auth/signup?cell=1654654654"></a>

i dont know how to pass cell in template...

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

Add table columns dynamically with Angular.js

I'm trying to use Angular.JS to dynamically add columns to an html table.

It starts with a set of data, and I want to make extra data available on a click. I'm new to Angular, and made this plunker to illustrate what I'm trying to do. I'd like to...

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

Iterate through an array of objects Angular 2

I have an array of objects received in service file from a json file. When I subscribe it in the component and try to iterate through it, I am getting the following error:

EXCEPTION: Error in...

Read the entire recipe Recipe added 1 day ago