angularjs-scope

ng-bind not updating after closing modal form

允我心安 提交于 2019-12-10 23:42:17
问题 I have a view with one list item. After user clicked on this item, the modal form show. When user change value and close modal, the item-not not updating. View: <ion-view ng-controller="settingsController"> <ion-content> <div class="list"> <ion-item class="item-icon-left" ng-click="openLanguageModal()"> <i class="icon ion-chatboxes"></i> {{'Language'| translate}} <span class="item-note"> <div ng-bind="choice"></div> </span> </ion-item> </div> </ion-content> <script id="language-modal.html"

how to use $compile in angular component angular 1.5 and above

a 夏天 提交于 2019-12-10 23:34:39
问题 I am migrating from directive to component but error is getting while using $compile As : $compile(ReturnDomElement)(scope); What should be used instead Of $scope As I dont injected $scope in my component. 来源: https://stackoverflow.com/questions/39776460/how-to-use-compile-in-angular-component-angular-1-5-and-above

Angular app is not defined when adding a custom filter outside of function

北城余情 提交于 2019-12-10 22:55:42
问题 Trying to follow some examples, but I get app is not defined app.js (function () { "use strict"; var app = angular.module("deviceManagement",['angularUtils.directives.dirPagination']); }()); So I have HOPING to be able to use or attach to "app" I have a controller js file (function () { "use strict"; angular .module("deviceManagement") .controller("DeviceListCtrl", ProductListCtrl); function ProductListCtrl($http, $scope) { var vm = this; vm.devices = []; deviceList(); function deviceList() {

Angular View Not Updating with New Data

风格不统一 提交于 2019-12-10 21:08:52
问题 I'm a bit of an Angular newbie so sorry if this is obvious. I have a backend which returns an array of objects. After I retrieve them, I move to the next page and i need to display a checkbox for each of the objects. I can successfully retrieve them, so I change the location of browser to the next page where the checkboxes should be displayed but nothing is being displayed. I tried using $scope.$apply() however it throws an error stating that a digest is already taking place but I think that

AngularJS:AppLevel controller possible?

不打扰是莪最后的温柔 提交于 2019-12-10 20:55:55
问题 I have a controller that is the controller for my page but i was wondering if its possible to have a AppLevel controller i.e. something that is accessible from every page... so each page would actually have more than 1 controller assigned. I know i can probably do this with a service and inject the service but I was hoping for some kind of applevel controller that can be assigned. If this possible, how would i communicate between the 2? I presume using dependency injection and just pass the

AngularJs: pass $scope variable with service

百般思念 提交于 2019-12-10 20:49:46
问题 I have two controllers and in one of them I declared a $scope variable that I would like visible in the second controller. First controller app.controller('Ctrl1', function ($scope) { $scope.variable1 = "One"; }); Second Controller app.controller('Ctrl2', function ($scope, share) { console.log("shared variable " + share.getVariable()); }); I researched the best Angular approach and I found that is the use of service. So I added a service for Ctrl1 Service .service('share', function ($scope) {

AngularJS : Scope issue in $http success callback

偶尔善良 提交于 2019-12-10 20:25:23
问题 I'm using PHP to get data into my factory, which shows correctly in the success callback function within the controller. However, even after assigning the returned data to $scope.customers, it's not there if I do a console.log($scope.customers) after the callbacks, and my view's [ng-repeat] isn't picking it up either. Any idea why the scope of my data would be restricted to just inside the success callback if I'm assigning the returned data to my $scope object? var customersController =

Angularjs with Internet Explorer 11, security issue

南楼画角 提交于 2019-12-10 20:03:12
问题 I'm using Angularjs for some months and it works like a charms in Chrome/Firefox/Safari but face some problems with IE11 and Edge. It seems my problem come from ng-src since images are not displayed and src attribute is never set. Here is the code: <div class="cell col-xs-12 col-sm-6 col-md-4 col-lg-3" ng-repeat="obj in DATA.objects | orderBy:objectsOrder track by $index "> <div ng-click="setCurrent($event, obj, '{{'obj_nav_' + $index}}')"> <img ng-src="{{formatURL(obj.Id, obj.img.fileName)}}

why list is not display while using collection-repeat instead of ng-repeat

旧城冷巷雨未停 提交于 2019-12-10 18:42:11
问题 I used ng -repeat in my demo .But due to large data coming from service .I want to use collection-repeat for performance better .how I will use collection-repeat to get the same out put here .here is my plunker <ion-scroll scrollbar-y="true" delegate-handle="i" ng-style="viewHeight"> <div class="row" ng-repeat="column in i | limitTo: counter track by $index" ng-class-odd="'odd-row'"> <div class="col brd collapse-sm" ng-repeat="field in column.columns" ng-show="i[$index].checked && i[$index].f

Ionic: Preserve $scope when navigate to another view

爷,独闯天下 提交于 2019-12-10 18:36:36
问题 I'm developing an app using Ionic Framework (Angular+Cordova). The app have a News section with a list of news loaded from a server in JSON, then I tap in a new to open the Single New's View, but when go back to the list of news, $scope has been cleared and must get again the news list from the server. Is this the usual behavior or am I doing something wrong? How could I prevent this behavior? Thanks! 回答1: You should save this kind of data in a separate service, something in the line of this: