Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

347
Views
Cómo usar UpgradeComponent en una directiva AngularJS que usa $attrs en Angular

Actualmente tengo esta .directive en AngularJS:

 aegroApp.directive('poorLegacy', function () { return { restrict: 'E', scope: { hasSomething: '=?', anotherBinding: '@', }, controller, templateUrl: function (_, attrs) { return attrs.hasSomething ? 'file.html' : 'file2.html'; }, } }); function controller($attrs, /* others */) { // perform some checks with $attrs // rest of the code }

y estoy tratando de usar UpgradeComponent para poder usar esto en Angular:

 @Directive({ selector: 'my-bridge' }) export class MyBridgeDirective extends UpgradeComponent { @Input() hasSomething?: boolean; @Input() anotherBinding?: string; constructor(elementRef: ElementRef, injector: Injector) { super('poorLegacy', elementRef, injector); } }
 <my-bridge [hasSomething]="false"></my-bridge>

Pero falla... y el motivo se explica aquí (básicamente no es compatible $attrs ).

Entonces, la pregunta es: ¿cómo podría usar esa directiva heredada sin volver a escribir esto ahora?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!