back soft

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

Angularjs $http post promise

Vote count: -1 I try to use the promise respond from a $http.post, to get back the new ID of the record as integer and use it for the next $http.post. I used How do I retu the response from an asynchronous call? for help but it still don´t work. var streckenId; var trackpunktId; var getStreckeID = function () { $http.post(dbStrecke, {"ort": location, "distanz": km}).then(function (response) { streckenId = response.data; console.log("ID (then): " + streckenId); // retu ID }); retu streckenId; }; streckenId = getStreckeID(); console.log("StreckeID:" + streckenId); //retu undefined The last console.log still say that "streckenId" is undefined. asked 2 mins agoJ4ck Let's block ads! بخوانید...

ادامه مطلب

angular2 (angular2-seed) using paths in imports avoiding ../../

Vote count: 0 I'm using angular2-seed: https://github.com/mgechev/angular2-seed How to create a variable to use imports absolute link instead of relative, like this: import { MyService } from '@shared/services/MyService'; instead of: import { MyService } from '../shared/services/MyService'; to avoid relative import paths ../../... An example of this is the @angular import: import { Component, OnInit, ViewEncapsulation } from '@angular/core'; How is it defined? Can we do something like this for our shared folder? asked 1 min agosurfealokesea Let's block ads! بخوانید...

ادامه مطلب

ng pattern in angularjs for email of abc domain

Vote count: 0 I'm trying to validate an input text field in angularjs such that only users of abc dot com domain can register. Can you please share the code for this patte validation? asked 36 secs agoAddi R Let's block ads! بخوانید...

ادامه مطلب

Angular2 Global user object in every component

Vote count: 0 Hy! I am able to share Parent container's property via attribute directive and inputs, but it doesn't work if the child component is pulled in by . Any advice how to share with every component? Btw i get the global user with async call in the app.component. asked 2 mins agoSándor Veres Let's block ads! بخوانید...

ادامه مطلب

angular 2 rc1 how to import external js library

Vote count: 0 I am trying to use joint.js with Angular 2. Here is what I did. index.html config.js var map = { 'app': 'app', // 'dist', 'rxjs': 'https://npmcdn.com/rxjs@5.0.0-beta.6', 'angular2-in-memory-web-api': 'https://npmcdn.com/angular2-in-memory-web-api', // get latest 'joint': 'https://cdnjs.cloudflare.com/ajax/libs/jointjs/0.9.7/joint.js' }; //packages tells the System loader how to load when no filename and/or no extension var packages = { 'app': { main: 'main.ts', defaultExtension: 'ts' }, 'rxjs': { defaultExtension: 'js' }, 'angular2-in-memory-web-api': { defaultExtension: 'js' }, 'joint': { defaultExtension: 'js' }, }; service.ts //declare var joint: any; import * as joint from ...

ادامه مطلب

Angular JS callback not initializing data

Vote count: 0 I'm having trouble with callbacks and asynchronous requests in angular. I created a service to fetch the data which uses callbacks (once the calls_left hits 0, callback is called). I inject my service inside my controller and then call the getMInterval on my service (metr.getMInterval) which should initialize the data (pTypes in this case) and wait till it is finished. The problem is that pTypes logs first as empty Array []. Any ideas? Service: angular.module('mService', ['config']).service('metr', function($http, $window, $rootScope, $location, config) { var pTypes = []; var intervalData = {}; function fetchMInterval(callback) { var calls_left = 1; var onComplete = function() ...

ادامه مطلب

Dependency Injection with Exact Example using Angular Javascript

Vote count: 0 I am New to lea a Angular Javascript. Can anyone gave me the knowledge of Dependency Injection with Its Demo Example. So That I did lea from there. No Good and clear link I have found from Googling. asked 1 min agoSupriya Pandey Let's block ads! بخوانید...

ادامه مطلب

What is best pattren for angular js: MVVM or MVC?

Vote count: 0 I am new in angular js. I want to know difference between MVVM and MVC framework and which one is best for angulr js. I know about MVC and MVVM patte but I can not find which one is best and why? Thanks, Hitesh asked 2 mins agoHitesh Let's block ads! بخوانید...

ادامه مطلب

Angular module and controller files don't seem to run

Vote count: 0 I have the following Angular declarations, and get no complaints about JS syntax errors or anything like that: App.js: (function () { 'use strict'; var hookPointApp = angular.module("hookPointApp", []); hookPointApp.controller("agentCtrl", function ($scope, $http) { $scope.model = {}; ... }); })(); suburbsCtrl: (function () { 'use strict'; angular.module("hookPointApp").controller('suburbsCtrl', function ($scope, $http) { ... // TODO Get a proper provinceId somehow. $scope.areas.getOptions(1); ... }); })(); Then I have a repeater with options declared like: - Select an Area - {{item.Label}} Yet getOptions isn't called when I change the select option, and breakpoints I put in th...

ادامه مطلب

Angular js Playing Audio

Vote count: 0 I have tried to implement audio notification when button click and am using AngularJS for my back end coding. i have tried to search proper reference still i couldn't find proper reference. Any pointers will be appreciated. Thanks. asked 1 min agoJanaka Sampath Let's block ads! بخوانید...

ادامه مطلب

Make an object for angularJS controller using $resource (factory|service)?

Vote count: 0 My approach is using AngularJS Service instead of factory along the project. Now I want to build an object called MyData which should be used as array in angularJS controller, such as: vm.datas= MyData.query({}, function (datas) { vm.thisData = {selected: datas[0].id}; }); As I searched in questions, I understood I can use factory as below: angular.module('myDataService', ['ngResource']). factory('MyData', function($resource){ retu $resource(myURL, {}, { query: {method:'GET', isArray:true} }); }); What should I do if I want to use service. Is the code correct, below? What is the best practice? angular .module('app') .service('myDataService', myDataService); myDataService.$injec...

ادامه مطلب

using angular $http and php to retrieve data

Vote count: 0 i can send data to mysql table and it is working good. now i want to get that data. i tried this code but it doesn't show any data from mysql table. can anyone help? maybe there is a different way? thank you PHP code: Controller: "use strict"; var app = angular.module('dataSystem',[]); app.controller('customerCardsCtrl',function($scope,$route,$location,$http){ $http({method:'GET', url:'api/get-allCustomers.php'}) .then(function(response) { $scope.customers = response.data; }) // This will log you the error code and trace, if there is an error. .catch(function(err) { console.log(err) }); }); }); html code: ufeff כאן יהיו רשימת כרטיסי לקוחות {{ x.customer_id}} {{ x.first_name }} ...

ادامه مطلب

Strongloop loopback-component-storage + angularjs file upload

Vote count: 0 I created a Container model and coected it to an S3 bucket which all works well. I am trying to upload a file using Angular, using the service file generated with lb-ng. If I do Container.upload({container: 'wonderyadmin'}, {file: file}) call will fire but nothing uploads. Am sure I have just got the params wrong but caot find any example of the angular library being used, and the official example at https://github.com/strongloop/loopback-example-storage uses a different angular uploader to handle the upload, which I'd like to avoid if possible. Thanks! asked 38 secs agothirstyross Let's block ads! بخوانید...

ادامه مطلب

Angular Route resolving with async service

Vote count: 0 I've been using Angular for a few weeks now and I love it for the most part. I'm now in the process of improving my code (which already works, but not as efficiently as it should). Basic idea: basic web-app template (like a fixed header menu) with options to jump to different parts of the web-app (read: different views+controllers set-up in routes) - Got it, that works :) each view(+controller) has a security aspect, not everybody should be able to go to every view. So, the security aspect seemed logical to implement as an Angular Service. The Singleton patte seems a perfect fit (below is simplified from what I have now). app.service("Security", [ "$http", function($http) { thi...

ادامه مطلب

Missing node_modules when deploying AngularJS2 application to Bluemix

Vote count: 0 we're trying to deploy a AngularJS2 application to bluemix but we're missing the folder "node_modules" after the application was deployed to the server. To build the application we're using npm. I found the following post that is mentioning the problem (https://developer.ibm.com/answers/questions/181207/npm-install-within-subdirectory-not-creating-node.html), my question would now be: what's the recommended best practice? edited 5 secs ago asked 6 mins agoJohaes Let's block ads! بخوانید...

ادامه مطلب

angular material md-tabs pagination don't work when the tabs are aligned to right

Vote count: 0 When I aligned md-tabs to the right using this code: .my-container .md-tab { float: right; } .my-container md-pagination-wrapper { right: 0; left: inherit; } it worked, but the pagination did no work, I see the pagination arrows but they are disabled. How can I fix this issue? Thanks asked 1 min agocode rumble Let's block ads! بخوانید...

ادامه مطلب

angular2 + typescript: is it possible to configure compiler to see my source code line in error stacktrace?

Vote count: 0 in Angular 2 project written in typescript and packaged with webpack I add e.g. following throw to welcome.ts file: @Page({ templateUrl: 'build/views/welcome/welcome.html' }) export class Welcome{ constructor(){ throw('something went wrong') } } In JS console, I see following error and stacktrace: EXCEPTION: Error: Uncaught (in promise): EXCEPTION: Error during instantiation of Welcome!. ORIGINAL EXCEPTION: something went wrong ERROR CONTEXT: [object Object]BrowserDomAdapter.logError @ browser_adapter.js?f9d6:77 BrowserDomAdapter.logGroup @ browser_adapter.js?f9d6:87 ExceptionHandler.call @ exception_handler.js?1ee2:57 (anonymous function) @ application_ref.js?7cf8:194 EventEmi...

ادامه مطلب

Input and output in angular2

Vote count: 0 I'm creating an angular2 application. I have a child component (MountainListComponent) which is made up of other components (but that's not important) that is included into a parent component. In the child component I have a list of mountains (), when I click on a mountain I'd like to pass a boolean variable (hidelist) to the parent component. The code of these 2 components are below. I've removed boilerplate code. Parent component: import {Component, Input} from "angular2/core"; import {MountainListComponent} from "./mountain-list.component"; @Component({ selector: 'my-mountains', template: `hidelist value: {{hidelist}} ` }) export class MountainsComponent { hidelist = false; ...

ادامه مطلب

Karma cannot find angular2 "barrel" import

Vote count: 0 We've got an Angular2 project using the barrel import patte. I'm attempting to write unit tests for it, however Karma caot seem to find the modules that are referenced by the barrel statements. The file being tested imports using: import {provider1, provider2, provider3} from "../../../core/providers"; import {component1} from "../../controls"; And karma outputs the following waings: 13 05 2016 08:57:43.732:WARN [web-server]: 404: /base/src/app/core/providers 13 05 2016 08:57:43.732:WARN [web-server]: 404: /base/src/app/core/controls Now the section of the karma config file that loads our client scripts: // paths loaded via module imports { patte: "src/app/**/*.js", included: f...

ادامه مطلب

Can I initially retrieve x number of records, and then every new record going forward with AngularFire?

Vote count: 0 I'm trying to initially retrieve the first x number of records from my firebase with AngularFire, I know I can limit the number of records with a query: var query = ref.orderByChild("timestamp").limitToLast(myNumber);. However, this also makes it so any new records bump out older records on the client. I want to retrieve a certain number of records, and going forward recieve every new record. I am not sure how I would go about doing this using the $firebaseArray object. asked 1 min agoDouglas Gaskell Let's block ads! بخوانید...

ادامه مطلب