Vote count: 0 In my AngularJS application, I have a standard CRUD component that manages most of the systems entities. This component (which is a directive) is basically a table that receives its columns metadata (JSON) and do its magic. The thing is, each entity has its own columns, and I want to load them with a simple call to a service like MyService.getColumns(entity). I could do a huge switch statement (like shown above), but I don't want that because any user that log in the system would have the load the metadata for all the entities available in the system, maybe to manage only one. A (not desired) solution to my situation: switch(entity.name) { case 'FOO': retu [column1JSON, column2...
ادامه مطلبVote count: 0 I use oauth authentication to login user. after use logined in, get taken from URL. URL like this: http://xxx/callback#access_token=xxx. then redirect to other page. I use this.router.navigateByUrl to redirect, the hash tag is removed. but when i click other link,the hash fragment will show again. how can i remove the hash token fragment permanently? Example: after use login in //xxx/callback#access_token=xxx redirect to //xxx/home then click linkA, the url is //xxx/linkA#access_token=xxx expected url is //xxx/linkA Thanks asked 1 min agoWenbo Chu Let's block ads! بخوانید...
ادامه مطلبVote count: 0 i'm whiling to know how to add a side menu on my current NativeScript + Angular 2 project, I know that has a side menu template, but i started it as blank project and i'm wonder how to add this feature. asked 31 secs agoBenevides Lecontes Let's block ads! بخوانید...
ادامه مطلبVote count: 0 For example I have following input field inside some bigger form: Input field has formControlName directive for form model and one custom directive for manually setting value with jquery datepicker: import { Directive, ElementRef, AfterViewInit } from "@angular/core"; declare var jQuery:any; @Directive({ selector: "[bootstrapDatepicker]" }) export class BootstrapDatepicker implements AfterViewInit { private el: HTMLElement; constructor(el: ElementRef) { this.el = el.nativeElement; } ngAfterViewInit() { jQuery(this.el) .datepicker() .on("changeDate", function(e) { // ??? }.bind({el: this.el})); } } After i choose date from datepicker, input value is visually changed, but form mo...
ادامه مطلبVote count: 0 i am trying to use gradient for my charts with angularjs1 using angular-chart.js version 1.0.0 but it seems that fillcolor does not recognize gradient here is my code down below var app = angular.module('starter', ['ionic', 'ngCordova', 'chart.js', 'ionic-modal-select']).controller('graphCtrl', function($scope) { var ctx = document.getElementById('base2').getContext('2d'); var gradient =ctx.createLinearGradient(0, 0, 0, 400); gradient.addColorStop(0, 'rgba(243, 103, 101,0.5)'); gradient.addColorStop(1, 'rgba(0, 89, 179,0.5)'); $scope.labels2 = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; $scope.data2 = [ [65, -59, 80, 81, -56, 55, -40], [28, 4...
ادامه مطلبVote count: 0 As a part of leaing process, I am roaming around angular js routing concepts.. for this I created one ier folder inside app with two sample test html pages .. when i run the app it should load first page from that folder but it does not not happening .. I am not sure where i have done wrong in this code... Below is my controller code var myApp = angular.module('myApp', ['ngRoute']); myApp.config(function ($routeProvider) { $routeProvider .when('/', { templateUrl: 'Pages/main.html', controller: 'mainController' }) .when('/second', { templateUrl: 'Pages/second.html', controller: 'secondController' }) }); myApp.controller('mainController', ['$scope','$log', function($scope,$log) {...
ادامه مطلبVote count: 0 I'm trying to call another function within my factory but i get this error. i did what others said in this link. i could not find the problem. where did i go wrong? Thanks! .factory('UserPreferences',function(Http,ngDialog,Notification){ var settings = {} retu { authenticated: false, settings:{}, save_settings: function(data){ var data = { url: '/pointofsale/userpreferences/save', data: data } Http.Post(data) .success(function(data){ statusMessage = data ngDialog.closeAll(0) }) }, authenticate_change_settings: function(user,settings){ this.settings = settings var data = { url: '/pointofsale/authenticate_change_settings', data: user } Http.Post(data) .success(function(data){ if(...
ادامه مطلبVote count: 0 Im using angular-cache library to cache my rest query to browser in AngularJS, angular.module('fbc') .service('OrganizationService', function (CacheFactory, $http) { // Service logic var settings, organizationCache, baseURL = "https://api.myapp.com/1"; if (!CacheFactory.get('organizationCache')) { // or CacheFactory('bookCache', { ... }); CacheFactory.createCache('organizationCache', { deleteOnExpire: 'aggressive', recycleFreq: 60000 }); console.log("No CacheFactory"); } organizationCache = CacheFactory.get('organizationCache'); settings = { cache: organizationCache }; retu { getAllOrganization: function (promise) { retu $http.get(baseURL + '/Organization', settings) .then(prom...
ادامه مطلبVote count: 0 i want get days of week from data weather json , am useing this code ' var dayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; var date = new Date(); $scope.wDay = dayNames[date.getDay()]; html {{wDay}} get result only one day 'sun' not all days of week json data `"daily": { "summary": "لا أمطار خلال الأسبوع مع درجات حرارة ترتفع حتى 50°C يوم الأربعاء", "icon": "clear-day", "data": [ { "time": 1469912400,` asked 1 min agorazak Let's block ads! بخوانید...
ادامه مطلبVote count: 0 In app.js file I am trying to call another js file with my controller, as I call another file? I'm trying to use controllerURl, but he insists on calling my standard file controllers.js App.js -> .state('app.mapa', { url: '/mapa', views: { 'menuContent': { templateUrl: 'templates/mapa.html', controllerUrl: 'controllers/mapa.controller' } } }) mapa.controller.js var app = angular.module("myModule", []) .controller("myController", function ($scope, $http) { console.log("teste"); $http.get("http://localhost:20432/WebService1.asmx/listPessoas") .then(function (response) { $scope.pessoas = response.data; }); }); Template - > Mapa.html Map Map asked 1 min agoMarco Sprea Let's block a...
ادامه مطلبVote count: 0 There are lots of resources out there already but I haven't been able to find one that works for one reason or another. Take a generic example: I want to get the response from http://swapi.co/api/people, which will be a list of people from Star Wars. import {Injectable } from '@angular/core'; import {Http, Response} from '@angular/http'; import {Observable} from 'rxjs/Observable'; import 'rxjs/add/operator/map'; @Injectable() export class OombaDataService { constructor(private http: Http) {} private usersUrl = 'http://swapi.co/api/people/'; getData() { retu this.http.get(this.usersUrl) .map(this.extractData) } private extractData(res: Response) { let body = res.json(); retu bod...
ادامه مطلبVote count: 0 if it does or does not, how can I make angular constantly check the conditional method or on the other hand make angular not constantly check ng-if. If I have an async call, how would I make angular recheck the ng-if method after async call is finished? asked 1 min agochonglawr Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I'm building an observable data service based on the following article: https://coryrylan.com/blog/angular-2-observable-data-services In the article he used an array as an example, here I will use the user object since I'm developing the user service. Here's what I got: import { Injectable } from '@angular/core'; import { Http, Response } from '@angular/http'; import { Events, SqlStorage, Storage } from 'ionic-angular'; import { Subject } from 'rxjs/Subject'; export interface DataStore { user: Object } @Injectable() export class UserService { private baseUrl: string; private storage: Storage; private _user$: Subject; private dataStore: DataStore; constructor( private http: Http...
ادامه مطلبVote count: 0 I am new to angularJS and leaing implementing webservices. I have a sevice that I hit on 'Post man ' that is working fine but when I am implementing this service in my angular code and i tested on Google chrome console it is giving me status 405 method not found error. I don't know the reason.Below is the code I am using var myApp = angular .module('myApp',[]) .controller('MyController', function ($scope, $http) { var parameter = JSON.stringify({search:''}); $http.post(url, parameter).then(function(response) { alert(response.data); }); }); asked 9 secs agoAbdul Waheed Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I have JSON like this { "cars":[ { "id":"012", "model":"honda", "parts":[ { "id":"p1", "name":"tyre", }, { "id":"p2", "name":"muffler", } ] }, { "id":"022", "model":"vw", "parts":[ ] } ] } I am new to AngularJS and I have 2 dropdowns, dropdown1 showing car models like: DROPDOWN1 honda vw and dropdown 2 that is supposed to be loaded with parts for selected car model in dropdown1. For example, if I select "honda" in dropdown1, dropdown2 should be loaded with: DROPDOWN2 tyre muffler If I select "vw" in dropdown1, then dropdown2 will not load since there are no parts for VW. I have html with 2 select (dropdowns) like this, note that I am using ng-options rather than repeat: Select ...
ادامه مطلبVote count: 0 I am trying to utilize angular's $http.jsonp() method to access data about a Vimeo video at an arbitrary url, say https://vimeo.com/176329517. I want a reliable way to pull the video id for a video, so I figured accessing Vimeo's API endpoint would be the most flexible way to go. Any idea on why the below code isn't working? // 'date' is new Date().getTime() const api = `http://vimeo.com/api/oembed/.json?url=https://vimeo.com/176329517 callback=JSON_CALLBACK&_=${date}`; $http.jsonp(req).then((resp) => { // trying to analyze JSON resp here }); asked 31 secs agoHarrison Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I'm trying to crate and angular2 project with a REST service, using node. Although I found some tutorials/sample codes doing this kind of applications, the organization of the code/project is different form each other. I'm trying to figure out what's the best way so far to do that. Basically, what is the best approach to create angular2 project with nodejs back end? how should be the folder structure? where to put the angular code(with typescript)? how to use bower/gulp? asked 4 secs agonick Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I am having trouble with my Angular JS ui-router and every question I have found on here shows a solutions I have already tried. In my ui-view-tag my actual template is not displayed. This is my app.js angular.module('myApp', ['ui.router']) .config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) { $stateProvider .state('home', { url: '/', templateUrl: 'home.html', controller: 'MainCtrl' }) $urlRouterProvider.otherwise('home'); }]) Thank you very much everybody, I would really appreciate a short feedback on that. asked 46 secs agopatrick Let's block ads! بخوانید...
ادامه مطلبVote count: 0 localhost:5555/dashboard Currently I am in dashboard component. In view I have a grid that will having link button will move to another component city component. So I need to pass state id dynamically from view. localhost:5555/dashboard/states/1/cities localhost:5555/dashboard/states/2/cities localhost:5555/dashboard/states/3/cities I am trying with this code in my component in angular 2.0.0-rc.1 This is giving me dashboard URL http://localhost:5555/dashboard not city URL http://localhost:5555/dashboard/states/3/cities Any Help...... asked 22 secs agoKrushna Mohanta Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I got service in angular with defined function: angular.module('services-data-service', []).factory('DataService', function ($resource) { retu $resource('rest/data/:method/', {}, { dictionary:{method:'GET', params:{method:'data1'}, isArray:false} ... }); }); I fetch data in controller by simply calling: ReportsService.data1(), but after adding new line: city:{method:'GET', params:{method:'city'}, isArray:false} when I call it from controller, I get nothing, there is no response in network log, but when I try to obtain webservice manually by typing URL in browser it works. Any ideas, why I can't call web service from angular's controller? asked 46 secs agoIwnow Let's block ads! ...
ادامه مطلب