angularjs-directive

Controller data set another page in angular

萝らか妹 提交于 2019-12-13 11:22:27
问题 After that clicked user.html list. I have to show clicked product data in productDetail.html file. ProductController.js $scope.selectedProduct = function(product) { console.log(product.post_title); } user.html <div ng-repeat="p in users.products | filter:searchBox"> <a href="#/{{$index}}/{{$index}}" ng-mouseover="selectedProduct(p)" ng-click="selectedProduct(p)" style="text-decoration:none;"> <ion-item class="item widget uib_w_109 d-margins item-button-left" data-uib="ionic/list_item_button"

AngularJS directive get value from scope

心不动则不痛 提交于 2019-12-13 10:31:56
问题 I'm passing my scope object to my directive and this works fine! After a get request I update my scope with a property called project. This contains some values like title, content, etc... If I log this everything is working fine but when I try to log scope.project I get the message undefined, but when I log scope I see the project object in the JSON tree... What can happens here? All console logs show the correct information but I can't access it... directive: .directive('project', ['$http',

Way to make backspace delete whole words at a time

China☆狼群 提交于 2019-12-13 10:03:50
问题 I have a text area: <textarea type="input" id="txtText">Hello+world-how*are+you</textarea> I want a way for backspace to delete a whole word every time it is clicked using Javascript or Angular js. When I press backspace I want it to split by operators and delete from the end. The first backspaces in the above example would delete 'you' then 'are' then 'how' and so on. But if the mouse is on 'world' then it deletes 'world' first, then 'Hello'. 回答1: Here is a solution than uses the data

Multiple check-box selection and create a tag based on selected option and also filter out the data in AngularJs

时光怂恿深爱的人放手 提交于 2019-12-13 09:54:20
问题 I want to provide multiple selection using check-box and depending on that it will create a tag using angular directive . If user selects multiple check-box then according to that tags should create and if user remove any tag then check-box should be unchecked. So depending on a selection and a removal of tag data should be filter out. Here is my Working CODE Thanks in Advance.! 回答1: Sounds like you are looking for some pre-built code. You can use Angular-multi-select in combination with a

Splitting the screens in AngularJS

Deadly 提交于 2019-12-13 09:07:40
问题 I have a requirement to split the screen into half and display the duplicate data on the other side of the screen. Initially this was achieved through a popup. Hence user can compare the data without switching the screen. I want to avoid the use of iFrames for this. Could anyone guide me on how to get started with this. My application is pure Angular. Thanks 回答1: Pretty much most of what you're looking for is in this tutorial: AngularJS, Master-Detail page It shows how to split the screen

Total memory increasing in IE with Angular Directive

心不动则不痛 提交于 2019-12-13 08:45:50
问题 Currently I am experiencing an issue when running my angular code under IE 11. Due to Angular being incredibly slow to render a nested ng-repeat (even with one way bindings) I came up with the idea of using a directive to render the other <td> elements without adding any unnecessary watchers. I´ve made a plunkr to simulate the issue I am experiencing. Directive code below: https://plnkr.co/edit/MNtShl6iWGFoXBHP2jmM?p=preview .directive('tdRenderer', function($compile, $filter) { return {

Newly added elements from angular directive not getting compiled

江枫思渺然 提交于 2019-12-13 08:26:35
问题 I wrapped my input tag with some div tags as per the requirement. Now the issue is, class of div tag is changing dynamically by angular, but seems this newly added div is not getting compiled and because of that, it is shown on the page (saw in view source in browser) exactly as I add it. No change is happening which it usually does if I add it directly on page instead of from directive. I tried adding {{ name }} also in this div but it also doesn't print the name property while adding it

dynamic css class in angular

本秂侑毒 提交于 2019-12-13 08:17:54
问题 I have following situation: json: [{"id":1,"prio":3}, {"id":2,"prio":3}, {"id":3,"prio":3}, {"id":4,"prio":4}, {"id":5,"prio":2}] HTML/Angular <ul ng-repeat> <li class="high">{{id}}</li> </ul> Now my goal is to change the css class automatically depending on the attribute 'prio'. When prio = 1 --> css= "low" when prio = 2 --> css = "medium" How can I achieve this? 回答1: Use ngClass : <ul> <li ng-repeat="item in arr" ng-class="{low: item.prio === 1, medium: item.prio === 2}">{{id}}</li> </ul>

Transferring data between non-nested components

隐身守侯 提交于 2019-12-13 07:38:07
问题 Basically , What I desire is to transfer data b/w components. I have one angular2 component on master page for partial view of login - <loginpartial></loginpartial> This is initially rendered through this html template with child component - <ul [hidden]="!item.isAuthenticated"> <li><a href="javascript:;">Hello! {{item.userName}}</a></li> <li><a href="javascript:;">LogOff</a></li> </ul> <ul [hidden]="item.isAuthenticated"> <li><a href="javascript:;">Hello! User</a></li> <li><a href=

Directive error $rootScope:infdig Infinite $digest Loop

天涯浪子 提交于 2019-12-13 07:16:53
问题 I downloaded a directive that receives only numbers and has some additional options; but, after running it I get a rootScope error in one of the options that is: <input type="text" ng-model="mynumber" nks-only-number allow-decimal="false" /> I believe the false conditional is making this error appear, but I don't know why. Here is the demo: http://jsfiddle.net/RmDuw/896/ Code: (function(){ angular.module('myApp', []) .directive('nksOnlyNumber', function () { return { restrict: 'EA', require: