angularjs-scope

Passing variables from one controller to another with $rootscope

ⅰ亾dé卋堺 提交于 2019-12-11 08:06:35
问题 I'm trying to pass the id from one controller onto the next using $rootscope. I thought it was as simple as setting the variable to $rootscope, but for some reason when i check in console it comes up as undefined. This variable will not change and i'd like to have it be "global" for all following controllers. Any reason why this isn't getting set? .controller('CubeHeadCtrl', ['$scope', '$rootScope', '$stateParams', 'cubeHeadFactory', 'localUserFactory', '$q', function($scope, $rootScope,

How to bind ng-click to a HTML block inserted inside of a directive embedded HTML block

我怕爱的太早我们不能终老 提交于 2019-12-11 07:23:46
问题 Plnkr: http://plnkr.co/edit/6xe46opL2kpgQrf7VaEu?p=preview I have a ng-click="switchCurreny() function that I'm trying to get working on an block of HTML that is placed inside of another block of HTML that is embedded on the page from my directive . My app-main controller that places another block of HTML into the directive placed HTML, also contains the ng-click function I'm trying to get working: var app = angular.module('app-main', ['ngAnimate', 'wallet-directives']) .controller('MainCtrl'

how to reload ng-repeat when i clicked button asp.net (angularjs)

半城伤御伤魂 提交于 2019-12-11 06:45:45
问题 How would you pass data code to angularjs variable. its working fine when the page loads. But when I click the button, for filter data. The server side does not load data. $scope.studentinformation = <%= studentattendancejson %> c# code: public static string studentattendancejson = string.Empty; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string Query = "SELECT ts.Idx, ts.student_name,ts.father_name,t.attendancedate,t2.class_name,tat.attendanceType FROM

Angular Guard is not able to access the Angular Service Object

浪尽此生 提交于 2019-12-11 06:37:25
问题 I am trying to access the Angular Service Object (I have set the AuthContext in service) but Angular Guard is giving undefined even though that is well set. I have login component, which I call first and internally It uses the Angular Auth Service. In the constructor of that service, I ensure that AuthContext is well set. Through the debug, I have seen that object is available with all the required claims. But then when I access the regular component (which I have guarded through the Auth

view is not updated in AngularJS

血红的双手。 提交于 2019-12-11 06:36:41
问题 I have an issue when I try to display data. I send my form and update my database (it works great, backend is ok) I use a button on the page to return to homepage The view of the homepage is not updated, always the same values. (It seems that there is only the template that loads, not with queries) I need to click on the button refresh of the browser to see new values. After the 'hard' refresh, the view is updated. Why do I need to completely refresh the page ? Here is my code JS : My service

Passing data from one controller to other Angular

允我心安 提交于 2019-12-11 06:17:29
问题 I have a controller which is fetching an XML file using $http and parsing it into a json object. This is 'MainCtrl'. Now I want to get the same json object in other controllers without again going through an $http because I have already loaded the XML. Here is my first controller angularXML.controller('MainCtrl', ['$scope', '$http','courseDefService', function($scope, $http, courseDefService) { $http.get(base_url + 'assets/js/angularxml/courseDef.xml').then(function(response) { var chapters =

Angularjs form with and without refresh

对着背影说爱祢 提交于 2019-12-11 05:48:13
问题 I would like to use an Angularjs form directive in the following way: if it's in /home redirect to /search/term and if already in /search process the submit without page refresh just changing the location. I know how to do both, but I don't know how to write a reusable code which works in both examples. 回答1: You won't be able to submit form data without a page refresh, unless you submit the data asynchronously via XHR. It sounds like you are submitting synchronously via HTTP POST or GET at

Angular directive 1 way binding is working but 2 way binding is not

血红的双手。 提交于 2019-12-11 05:44:57
问题 I am not using scope in my controller as i use controller as etc.. I have proof of concept that plunker without scope is working 1 way binding is working 2 way binding is NOT working - shows literal value HTML page WORKING Here: {{detail.program.ldcCode}} SHOWS "Here: PNLC" <lcd-code code="{{detail.program.ldcCode}}"></lcd-code> Above passes in 1 way binding of that object/value of PNLC to Directive ! Directive : return { replace: true, restrict: "EA", scope: { code: "@" }, link: function

Http Promise not resolving in controller

你。 提交于 2019-12-11 05:31:36
问题 I am just beginning to learn AngularJS and have a problem understanding promises. I have factory which makes call to back-end server and returns a promise as follows: var commonModule = angular.module("CommonModule", []) .factory('AjaxFactory', function($http, $q, $dialogs, transformRequestAsFormPost) { return { post: function(reqUrl, formData) { var deferred = $q.defer(); $http({ method: "post", url: reqUrl, transformRequest: transformRequestAsFormPost, data: formData }).success(function

How to pass data to an angular-foundation modal $scope?

纵饮孤独 提交于 2019-12-11 04:58:10
问题 I am using angular-foundation and specifically the modal http://madmimi.github.io/angular-foundation/#/modal , i am confused in how to pass data to a modal while using one controller , i want to take an array value and update the modal to show a particular user info ,Ex: $scope.updateUserInfo = $scope.user[index] , the only issue is how to pass the data to the modal . myApp.controller('users',function ($scope,$location,$http,$modal,msg) { $http.get('api/v1/users') .success(function (data