angular-controller

'Promise' is undefined error when run on IE

有些话、适合烂在心里 提交于 2021-01-27 12:27:38
问题 I have a controller code that runs fine on Chrome, but when run on IE 10 the same code returns ReferenceError: 'Promise' is undefined The function that returns the error is: new Promise(function(resolve) { MetaModel.load($scope, (regionExist ? reqParmRegion[1] : reqParmRegion), (screenExist ? reqParmScreen[1] : reqParmScreen), resolve); }).then(function(){ loadRelationshipByStep($scope.preStep); if($rootScope.regionId === 'us') { $rootScope.currRel = 'itself'; } if($rootScope.screenId.indexOf

testing .success and .error of service in controller jasmine

筅森魡賤 提交于 2019-12-25 08:18:51
问题 I have a call to service's function in a controller. Below is the code Service (function () { 'use strict'; angular.module('MyApp') .service('MyService', ['$http', function ($http) { return { getMyData: function (extension) { return $http.get('www.something.com'); } }; }]) })(); Controller var getMyData = function () { MyService.getMyData(extension).success(function (results) { //Some functionality here }) .error(function (err, status) { //Some functionality here }); } $scope.Call=function(){

Angular ngModel different view and value

北慕城南 提交于 2019-12-24 16:00:07
问题 Does ngModel controller in directive have any option to show something different from ngModel value in view, or i have to write custom html directive for input? I wrote a comma-separator directive. everything is fine, but ngModel value change from Number to String with , . I mean can i have input with value 1000000 but it shows 1,000,000 in view? Update: In the input box shows 1,000,000 , but its value be 1000000 . Update 2 I know about $formatters and $parsers . but the problem is

AngularJS Upgrade (1.5 to 1.6,1.7) Makes directive scope bindings undefined

有些话、适合烂在心里 提交于 2019-12-17 06:50:49
问题 I have the following code: angular .module('myApp') .directive('layout', function () { return { restrict: 'E', template: '<div ng-include="layoutCtrl.pageLayout"></div>', controller: 'LayoutController', controllerAs: 'layoutCtrl', bindToController: true, scope: { pageLayout: '=', pageConfiguration: '=', isPreview: '=' } }; }); angular .module('myApp') .controller('LayoutController', LayoutController); function LayoutController($scope, LayoutDTO, LayoutPreviewDTO) { var self = this; self

Displaying json data in an Angular App

我是研究僧i 提交于 2019-12-13 01:05:55
问题 I am trying to parse data from a json file and display it in my angular application, but for some odd reason the view wouldn't show the data(intepret my expressions), I thought it might be my controller, but it looks fine. Any help would be appreciated in solving this, thanks. Below is the code for my Http Service: app.factory('info', ['$http', function($http){ return $http.get('https://api.flickr.com/services/feeds/photos_public.gne?&format=json&callback=JSON_CALLBACK') .success(function

The difference and relationship between the $scope passed in a controller, and the $scope passed in a directive

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 05:07:02
问题 What is the difference and relationship between the $scope passed in a controller , and the $scope passed in a directive ? And how would you set these up? 回答1: This is a brief explanation of what is the difference and relationship between the $scope passed in a controller , and the $scope passed in a directive is: As you can see form the basic Angular setup below, $scope is passed to both the Angular Controller and to the Angular Directive . But what are the differences, and how do these

Ionic - AngularJS: calling methods via template outside of Controller

点点圈 提交于 2019-12-12 03:05:11
问题 So, here's a sample code: <div ng-controller="MyControllerOne"> <span ng-click="foobar()">Click Me!</span> </div> Can I, from that template, without changing controller, call the function foobar() in MyControllerTwo : .controller('MyControllerOne', function($scope) { //some code }) .controller('MyControllerTwo', function($scope) { // method I wanna call function foobar(){ } }) 回答1: While not the prettiest solution, it is technically possible...ish. If you update your HTML to: <div ng

AngularJS error: [ng:areq] Argument 'TestController' is not a function, got undefined

邮差的信 提交于 2019-12-12 01:53:45
问题 I'm trying to make my first controller and getting this error: Error: [ng:areq] Argument 'TestController' is not a function, got undefined I've simplified my code to find the error but no luck. It looks to my like I'm creating the controller and the books array in the script and referencing the controller letter by letter in the div. What am I missing? <!doctype html> <html data-ng-app> <head> <meta charset="utf-8"/> </head> <body> <div data-ng-controller="TestController"> <ul> <li data-ng

Browser does not detect changes in AngularJS

混江龙づ霸主 提交于 2019-12-11 10:15:34
问题 Im developing an AngularJS application using IDE WebStorm and Safari browser. Everything has worked perfectly so far, but I recently encapsulated some HTLM in a template that I use via a directive: .directive('referenceValue', [function ($scope) { return { restrict: 'E', templateUrl: "views/citizenprofile/reference/reference.html", controller: "referenceValueCtrl" } }]) I "call" the directive the normal way, nothing fancy <reference-value></reference-value> When I edit the reference.html the

Display informations about a bubble chart D3.js in AngularJS

不想你离开。 提交于 2019-12-11 00:25:45
问题 I am searching how to display information about a bubble D3.js in AngularJS. I can show an alert with the desired information but I can't display informations on the page with AngularJS because I have no access to the $scope because my graphe is in a directive... How can I pass the informations without change the structure of the web app ? I can't put the formation the bubble chart outsite of this directive. This is my HTML : <body ng-app="d3DemoApp"> <div id="graph1" ng-controller=