angularjs-directive

Pass object to component

强颜欢笑 提交于 2021-01-26 19:49:11
问题 I have created a component that needs to have a reference to the object for which the component was created. I didn't make to work and all my trials have failed. Below, I try to describe the intention. The component definition would maybe look like this: angular .module('myModule') .component('myComponent', { templateUrl: "template.html", controller: [ MyController ], bindings: { myObject: '=' } }); function MyController(myObject) { var vm = this; vm.myObject = myObject; } In a service I

Pass object to component

两盒软妹~` 提交于 2021-01-26 19:48:35
问题 I have created a component that needs to have a reference to the object for which the component was created. I didn't make to work and all my trials have failed. Below, I try to describe the intention. The component definition would maybe look like this: angular .module('myModule') .component('myComponent', { templateUrl: "template.html", controller: [ MyController ], bindings: { myObject: '=' } }); function MyController(myObject) { var vm = this; vm.myObject = myObject; } In a service I

TypeScript Error While Using @Input()

只谈情不闲聊 提交于 2021-01-21 07:40:51
问题 I am trying to develop an app using Angular 4. But I have received an error message while using @Input('inputProducts') products: Product[]; The Error is [tslint] In the class "ProductListComponent", the directive input property "products" should not be renamed.Please, consider the following use "@Input() products: string" (no-input-rename). The Error Does Not Have any Effect and My App is working fine but it is annoying and am unable to remove it. Code Snippet is Given Below: import {

resize bar for sidenav in angular material design.

耗尽温柔 提交于 2021-01-14 08:02:06
问题 Is there a directive in angular material to resize sidenav? There is a sidenav which shows list of clients and the right pane has the details of the client. I am trying to add a resize bar between them. I used the following http://plnkr.co/edit/Zi2f0EPxmtEUmdoFR63B?p=preview which i found in the following Angular JS resizable div directive I tried following the above plunker example but the sidenav never resized. The right pane moves right but the left pane remain unchanged. <div layout="row"

how to copy the values present in ag-grid

南楼画角 提交于 2020-06-25 00:40:07
问题 I am using ag-grid to bind values from a list, Is it possible to copy the value/data in the selected cell. I have tried to copy the value using ctrl+c but its not working is there any other way? Please help me! 回答1: You can do this using CSS below: .ag-font-style { user-select: initial; -moz-user-select: text; -ms-user-select: text; -webkit-user-select: text; } This should work in any of the browsers viz IE, Chrome, Mozilla and may be Safari. 回答2: There is a flag which will allow you to

How do I add multiple conditions to “ng-disabled”?

◇◆丶佛笑我妖孽 提交于 2020-06-09 11:39:28
问题 I need to check that two conditions are both true before enabling a button: Here is an example: <button type="submit" ng-disabled="frmUser.pw2.$error.pwMatch" class="btn btn-primary" ng-click="ChangePassword()">Change</button> This example only contains one condition within ng-disabled . How would I add another such as a scope variable? 回答1: You should be able to && the conditions: ng-disabled="condition1 && condition2" 回答2: Wanny is correct. The && operator doesn't work in HTML. With Angular

How can I use ng-click on a directive with isolate scope?

我的未来我决定 提交于 2020-05-14 21:29:25
问题 I can get ng-click to work when the scope is inherited on a directive but not when isolated. UPDATE: The point is that I want the click function to be defined as part of the directive... moving the function definition into a different scope is not what I want. Here's the working example with inherited scope: https://codepen.io/anon/pen/PGBQvj Here's the broken example with isolated scope; https://codepen.io/anon/pen/jrpkjp (Click the numbers, they increment in the first example but not in the

Upgrade AngularJS directive with ngModel to Angular component

天大地大妈咪最大 提交于 2020-05-12 08:20:06
问题 I am trying to upgrade my AngularJS directive to Angular Component. Here is the code of directive: ng1AppModule.component('ng1Tmp', { bindings: {p: '<'}, require: {ngModel: 'ngModel'} }); And I tried to upgrade it by: @Directive({selector: 'ng1-tmp'}) class Ng1HTmpComponent extends UpgradeComponent{ @Input() p: string; @Input() ngModel: INgModelController; constrcutor(elementRef: ElementRef, injector: Injector) { super('ng1Tmp', elementRef, injector); } } It doesn't work well. It seems not to