back soft

مطالب مرتبط با «angular 2» در back soft | نویسنده: استخدام کار

Getting typescript to work for Angular 2 project with facebook login

Vote count: 0 I am trying to get up and ruing with Angular 2 and typescript. So far so good, but I am having some troubles to get a Facebook login message working. I found a project on github that demonstrated how this can be done. In this example, they have the following coector: fbcoector.ts export class FBCoector { constructor(appID: string) { if (!window.fbAsyncInit) { console.log('define'); window.fbAsyncInit = function() { FB.init({ appId: appID, xfbml: true, version: 'v2.5' }); }; } } initFB() { var js: any, id = 'facebook-jssdk', ref = document.getElementsByTagName('script')[0]; if (document.getElementById(id)) { retu; } js = document.createElement('script'); js.id = id; js.async = t...

ادامه مطلب

Error 400 when retreving JSON with $http.get in AngularJS

Vote count: 0 I get an error 400 when i try to retrieve the JSON from this URL below with $http.get. $http.get('https://api.spotify.com/v1/search?q=artist:Owl+City+title:On+The+Wing&type=track&limit=1'). success(function(data) { console.log("Success"); }) .error(function(error, status, headers, config) { console.log(status); console.log("Error occured"); }); I manage to retrieve it with this : $.getJSON('https://api.spotify.com/v1/search?q=artist:Owl+City+title:On+The+Wing&type=track&limit=1').then(function (data) { console.log("Success");}); But the problem is that when i try to change a value in my $scope with this method, it 's only displayed in the view, one action after, because of that...

ادامه مطلب

Ionic/AngularJS checkbox and ng-repeat from API

Vote count: 0 The idea was to send true checkbox values from mobile to API so I can place an order with selected condiments, however I cant to get a grasp on it. {{condiment.name}} {{condiment.price}} It calls the function: $scope.checkItem = function (id) { retu $scope.condiments[id-1].checked = true; }; (minus 1 is because ID starts at 1, and array at 0) But it is not called when checked/unchecked, but rather it makes all my resources checked by default, and once I click to uncheck them, nothing changes. Property 'checked' is not part of the original JSON API output for the condiment. It has ID, name and price. Question: Is there a less painful way to send checked ID's back to server? aske...

ادامه مطلب

Access elements on Angular site

Vote count: 0 I am looking to fill an array with elements on an AngularJS site. Here is my array code: $ProgramGuides = $ProgramGuidesPage.ParsedHtml.getElementById("content") | foreach { $_.getElementsByTagName("ul").item(0) | foreach { $_.getElementsByTagName("li") | foreach { $_.getElementsByTagName("a") } } } $ProgramGuides only retus 1 element meanwhile there are 10+ elements on the page. I can only imagine this has something to do with Angular and ng-repeat on the elements. Any ideas how I can get all the elements into my array? Here is the HTML of the Angular page: asked 1 min agoQuanda Let's block ads! بخوانید...

ادامه مطلب

Angular module loading error

Vote count: 0 I have an angular project that I'm breaking out into a better file structure but I'm getting Argument 'fn' is not a function, got undefined for an error when creating a new service. Any ideas what I'm doing wrong? app.js angular.module('app', [ 'app.controllers' ]); angular.module('app.controllers', ['leaflet-directive', 'app.services']); angular.module('app.services', []); main.controller.js angular.module('app.controllers') .controller('MainCtrl', MainCtrl); function MainCtrl($scope, $window, leafletData, DataService) { var main = this; main.items = DataService.GetItems(); //Other controller stuff }; data.service.js angular.module("app.services") .factory('DataService', DataS...

ادامه مطلب

Routing from Javascript lib in Angular JS 2

Vote count: 0 I am using Parse (an exteal JS lib) inside Angular JS 2. However, when I try calling the function gotoMain() from inside a call back function of Parse, it looks like things are not loaded properly. For example, when routing to 'Main' as in the code below, Main is loaded, however, the variables in Main are not bound properly and ngOnInit in Main is not called. export class LoginComponent { useame: string; password: string; msg: string; constructor(private _router: Router) { console.log("in Login component constructor"); } onSubmit() { Parse.User.logIn(this.useame, this.password, { success: function(user) { this.gotoMain(); }.bind(this), error: function(user, error) { // The logi...

ادامه مطلب

How can I couple a bootstrap data-toggle event to modify an angular model

Vote count: 0 I have code like the following: one two On page load the dropdown is hidden and the fa-plus icon is displayed. If the plus icon is clicked I update the 'opened' model variable so that the fa-minus icon is displayed. But also the data-toggle add the 'open' class to my 'dropdown' div. When the minus icon is clicked the reverse happens and everything is good. However, if when the menu is opened I click on another part of the page, the data-toggle will cause the 'open' class to be removed from the div, the dropdown is not displayed any longer. But my angular model 'opened' is not modified so the fa-minus icon is still displayed. Can anyone tell me how I can monitor for the addition...

ادامه مطلب

How to print Angular.js promise error status?

Vote count: 0 My code is like this, app.controller('myController', function($scope, MyService, ...) { MyService.getInfoFromUrl('MyUrl').then(function(result) { console.log("Successfully get info from URL ..."); }, function(error) { console.log("Server error ..."); console.log(error); }); }); So when i test it with error path, i see Server error ... Undefined What's the correct way to get error info please ? asked 2 mins agouser3552178 Let's block ads! بخوانید...

ادامه مطلب

AngularJS service injector error

Vote count: 0 I'm trying to make use of my API with AngularJS, I made a service which I'm now trying to load into a contoller, but I'm having some errors.. Unknown provider: ApiServiceProvider...

ادامه مطلب

Angular Kendo mobile overlay view on top of another view

Vote count: 0 Using Angular Kendo mobile can we have a overlay mobile view on top of another mobile view. In my app I have divided all the screen in html page with: ... Page related code goes here ... And I load these html pages as per user interaction using. kendo.mobile.application.navigate("myPage.html"); But I want have one view that can overlay on another/existing view.Basically this overlay will act as modal view. I can not add this modal view in all the screens that I have,And I want to keep it in a separate file and display on some events. asked 49 secs agoA_user Let's block ads! بخوانید...

ادامه مطلب

Using "extends" inside triangular brackets and a type "T" in Java

Vote count: 0 Part of the code that I'm trying to understand as a begier java student is below: public class StandardGA extends GeneticAlgorithm { private static final long serialVersionUID = 5043503777821916152L; private final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(StandardGA.class); /** * Constructor * * @param factory a {@link org.evosuite.ga.ChromosomeFactory} object. */ public StandardGA(ChromosomeFactory factory) { super(factory); } /** {@inheritDoc} */ @SuppressWaings("unchecked") @Override protected void evolve() { List newGeneration = new ArrayList(); // Elitism newGeneration.addAll(elitism()); // new_generation.size() < population_size while (!isNextPopulationF...

ادامه مطلب

Performance of large scale web application which uses AngularJS

Vote count: 0 I heard that some industry experts said when the web application is being large, AngularJS slow down your web application. So beware of using AngularJS when creating large scale web app. What is the real truth of that? asked 1 min agouser5493169 Let's block ads! بخوانید...

ادامه مطلب

How to create Fixed page links in angularjs dir-pagination-controls?

Vote count: 0 I am new to angularjs , I have trying to create fixed Page links in dir-pagination-controls in angularjs I have try to use 'total-items=100' but not working , I am getting all my values from web services , What I have tried app.controller('listdata',['$scope', '$http', function($scope, $http) { $scope.xxxx = []; //declare an empty array data = []; function getResultsPage(pageNumber) { console.log('Please wait while data is loadind'); $http({ method: 'POST', url: ajaxurl, params: { 'action': 'get_xxxx', 'pageNumber': pageNumber, 'usersPerPage': $scope.usersPerPage } }).success(function (data, status, headers, config) { $scope.xxxx = $scope.xxxx.concat(data); $scope.totalUsers = ...

ادامه مطلب

Syntax of member properties and constructors in angular 2 typescript

Vote count: 0 So I'm looking at an ionic 2 project which is using Angular 2 and Typescript and am a bit confused about how member properties are set. Looking at the example below, Angular automatically injects the dependencies in the constructor arguments. In the case of nav, we are explicitly setting the instance member nav to what's being passed in by the constructor. In the case of Firebase auth, we don't explicitly set it to a member variable, but we can still access it via this.auth, how come? if we try the same thing with this.nav it won't work unless we explicitly set the instance variable. What does using the private keyword do in the constructor parameters do - is it redundant to de...

ادامه مطلب

How to save selected option(dropdown box) in AngularJS

Vote count: 0 I want to save selected color in $scope.color. Index.html: What is your favourite colour?...

ادامه مطلب

AngularJS - Value on a dropdown list not binding to ng-model if no changes are being made

Vote count: 0 Please see my plunkr here https://plnkr.co/edit/QRQQmxf3ZDyh6o0CqtrD?p=preview I have a from with a dropdown list that gets populated as shown below: My Default Provider {{row.Text}} Submit in my controller i have a submit function as shown below: $scope.submit= function(){ $scope.selectedValue = $scope.frmData.defaultProvider; } When I click the submit button after selecting a different value in the dropdown list, I am able to see the selectedvalue, but if I don't select a different value, the ng-model="frmData.defaultProvider" is not getting the initial value. How can i get "frmData.defaultProvider" to bind with the default value when the page was loaded? asked 3 mins agoalia...

ادامه مطلب

Picklist with Angular JS parsing list

Vote count: 0 I have a list of strings with years on it, like: $scope.years = ["2001", "2002", "2003", ...]; I'm trying to render it on a page inside a select tag, but angular keeps breaking the code, rendering the elements outside the tag. I have the following in the page: ---- {!y!} I does render, but all the option tags that are generated, are outside the select tag. Am I doing something wrong here? Edit: using AngularJS 1.5.3 asked 48 secs agoRenato Oliveira Let's block ads! بخوانید...

ادامه مطلب

captcha directive with button angularjs

Vote count: 0 i tried this in directive .suppose if i entered it correctly it shows true but i want to activate button otherwise button was not valid. this is my thanks in advance please help to solve this problemhttp://jsfiddle.net/hspxaeqa/3/ edited 17 secs ago asked 2 mins agochaitanya Let's block ads! بخوانید...

ادامه مطلب

Angular - How to check if user is allowed before loading the view?

Vote count: 0 I have an angular app. I am using ui-router to manage my states. I need to call a common API to check whether the user is allowed to view the web page or not. Is there a common place where I can call the API and only then proceed to the state the user is requesting for? With my current implementation, the view partially gets displayed and then the reroute happens. //app.js $rootScope.$on('$stateChangeSuccess', function(evt, toState) { if(toState.name === 'login' || toState.name === 'payment') retu; userService.isBillingCleared().then(function() { //redirect to toState }, function() { $state.go('payment'); }); }); How do I prevent this? asked 1 min agoJaseem Abbas Let's block ad...

ادامه مطلب

Angular json marshalling via $http

Vote count: 0 I am having a very weird problem. Using $http my response is not getting marshalled correctly into map/object. The data is a map of lists. The issue is that the element 100110150000000751 has a value from the raw data in the first log "1 group data[". but after its converted to json it has the value of an empty array. You can see the image of the "after conversion" log. This all works fine in chrome with debugger open but not if debugger is closed. The method is so simple and there is little to no room for race conditions or anything. I created a little desktop html file with all the same libraries and just calling a function without $http and it works without issue. Angular 1....

ادامه مطلب