Vote count: 0 What is better when creating a controller in AngularJs: 1- angular.module('myApp') .controller('MyController',['$scope','dependencies','myService', function($scope, dependencies, myService ) { }]); 2- angular.module('myApp') .controller('MyController', function($scope, dependencies, myService ) { }]); asked 44 secs agoshireef khatab Let's block ads!...
ادامه مطلبVote count: 0 I have a angular2 component which is generating data to populate my ng2-table, but I caot seem to put HTML tags into a cell. Instead the cell renders as such: (Don't have enough reputation to post as an image) http://i.imgur.com/9D2zaJs.png https://github.com/valor-software/ng2-table/issues/51 I've tried to modify the js file that is coming down as indicated as an older fix but changing the markup to the [ierHtml] angular2 element does not appear to be accepted. It seems that others are having this problem as well, has anyone else found a solution? I'm aware that ag-grid is capable of doing this, but we need to use ng2-table as it supports bootstrap pagination which ag-grid doe...
ادامه مطلبVote count: 0 Hi I'm trying to update a button with the elapsed time. I can console log the timer, and update the button label once, but it's not updating with the time {{buttonLabel}} $scope.buttonLabel = "stop"; $scope.recordParams.timer = $interval(function(){ var time = getTimeElapsed(initialTime); $scope.buttonLabel = time; }, 100); i.e. it will change to 'stop' but I can't get it to update with the time. asked 39 secs agouser5839 Let's block ads! بخوانید...
ادامه مطلب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! بخوانید...
ادامه مطلب