angularjs-scope

AngularJS setting model value from directive and calling a parent scope function holds on to the previous value inside that function

亡梦爱人 提交于 2019-12-13 06:27:13
问题 js fiddle http://jsfiddle.net/suras/JzaV9/4/ This is my directive 'use strict'; barterApp.directive('autosuggest', function($timeout, $http) { return { restrict: "E", scope: { modelupdate:"=", suggestions:"=", urlsend:"@" }, template: '<ul><li ng-repeat="suggest in suggestions" ng-click="updateModel(suggest)">{{suggest}}</li></ul>', link: function (scope, element) { scope.$watch('modelupdate', function() { $timeout(function(){ $http.post(scope.urlsend, {q:scope.modelupdate}).then(function

Setting $scope.myModel element with ng-change enters in infinite loop

巧了我就是萌 提交于 2019-12-13 06:01:01
问题 I'm pretty new to Angular and trying to achieve something "basic". I've been googling for 2 days without success and would appreciate some help. I have an html page on which I'm trying to: Initialize data with a HTTP POST request Call a function via the ng-change event to update the data with another HTTP POST when elements used as filters are changed (i.e. categories, sorting asc/desc...) My problem is that when I'm updating the model programmatically with the HTTP response (only in this

Directive doesn't work when I which the version of Angular to 1.0.1 to 1.2.27

为君一笑 提交于 2019-12-13 05:43:28
问题 The following could be run in demo here. this is html: <div ng-controller="MyCtrl"> <h2>Parent Scope</h2> <input ng-model="foo"> <i>// Update to see how parent scope interacts with component scope</i> <br><br> <!-- attribute-foo binds to a DOM attribute which is always a string. That is why we are wrapping it in curly braces so that it can be interpolated. --> <my-component attribute-foo="{{foo}}" binding-foo="foo" isolated-expression-foo="updateFoo(newFoo)" > <h2>Attribute</h2> <div> <strong

How can I access UI-Grid isolate scope from outside?

左心房为你撑大大i 提交于 2019-12-13 05:34:30
问题 There is a button outside of angular UI grid. I would like to call a function on "Default" button click and post grid object parameter to the callback function. There is a second example as well. But instead of posting grid object to the buttons inside of the grid I would like to post the grid object to the button outside of the grid. To cut a long story short I would like to have an edit button outside of the grid (select one row mode is turned on) instead of adding a column of edit buttons

Scope doesn't get associated with new element added in compile phase

我是研究僧i 提交于 2019-12-13 05:33:23
问题 In below code i am trying to add a button at compile phase, and assigned ng-click to a method from scope. During linking phase, through debugging I found the "compiledEle" contains the button, then also ng-click doesn't call the scope method. angular.module("app", []) .controller("ctrl1", function($scope){ $scope.myModelObj = { name: 'Ratnesh', value: 100 }; }) .directive("dirOne",function($compile){ return { restrict: 'E', scope: { myModel : "=" }, compile: function(ele){ ele.append("<button

how to make tab bar in angular js with sliding effect?

烂漫一生 提交于 2019-12-13 05:30:12
问题 how to make tab bar or navigation bar in angular with sliding effect .I am able to make in jQuery mobile .Here is my fiddle http://jsfiddle.net/ezanker/o9foej5L/1/ When I used same thing in angular it not work I need to do same thing in angular js .can you please tell me how we can achieve this in angular js Plunker: http://plnkr.co/edit/ornYCV15uV8lPNL1ujPL?p=preview <html> <head> <link data-require="bootstrap-css@3.x" data-semver="3.2.0" rel="stylesheet" href="http://maxcdn.bootstrapcdn.com

Angular compile template error on local project and jsFiddle, but working fine in Plunker

只愿长相守 提交于 2019-12-13 05:17:52
问题 I've noticed my angular controller is growing and have been trying to refactor and use directives and services. However, on one scenario, i am trying to create a directive which appears to be working fine in plunker, however i am seeing the following error in my local application and in jsFiddle: Error: [$compile:tplrt] http://errors.angularjs.org/1.2.8/$compile/tplrt?p0=getEmptyCells&p1= Plunker link: http://plnkr.co/edit/e11zA8LKvoPTgTqW2HEE?p=preview jsFiddle link (error can be seen in

how to make filters with $scope variables inside controllers of directives

核能气质少年 提交于 2019-12-13 05:16:40
问题 I have found lot of conventions to write code in angular JS. I am using the following convention. app.directive("employeeList" , function(){ return { restrict : 'E' , templateUrl: 'employee-list.html', controller:function($scope , $filter) { $scope.emp_positions = positions_json; // my FIREST array $scope.emp_users_json = users_json; // My SECOND Array //My Code Logic // // I WANT TO MAKE FILTER HERE WHICH CAN USE $SCOPE VARIABLE. IS THERE ANY WAY TO MAKE FILTER HERE LIKE $SCOPE.FILTER(

how to reduce the height of header in tabel view or grid view?

久未见 提交于 2019-12-13 04:54:07
问题 I am trying to make simple demo of grid view .In which I have header of title (having gray background) actually I need to reduce the height of title or headers of table which have gray background .can we add alternate color of rows ? please see the given image .It header or tittle is too small as compared to my plunker .Secondly there is alternate color in row .can we add that in my plunker . http://plnkr.co/edit/7bSnk0fU0NBOF1GIwHSK?p=preview .search.list-inset, .search.list-inset .item

Angularjs directive clicking elements

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 04:52:53
问题 Hi I was wondering when I have a list of elements from a ng-repeat, how I can allow the user to click one of the list and make it highlight via .css(). Then if the user clicks another element, the previous element un-highlights and the newly-clicked element highlights? Thanks 回答1: You may try to use ng-click to set the selected item and apply a conditional css class with ng-class: <ul> <li ng-repeat="item in list" ng-class="{'highlight': model.selected == item}"> <button ng-click="model