简体   繁体   中英

Calling jQuery plugin in AngularDart: no execution, no error, doesn't work at all

I'm trying to call a jQuery plugin from my Dart application in main.dart with this simple code (which I found on the internet; I'm pretty new to Dart and so angularDart ):

import 'dart:js';

void main() {

  bootstrap(AppComponent, [
    // my providers
  ]);

  final options = new JsObject.jsify({
    'menuWidth': 300,      
    'edge': 'left',      
    'closeOnClick': true,      
    'draggable': true
  });
  context.callMethod(r'$', ['.button-collapse'])
         .callMethod('sideNav', [options]);
}

But it doesn't do anything at all. It's not working, and also there is not any error! Have you any idea where am I doing wrong? Thanks in advance.

That looks reasonable. Is there also no output on the browser console?

The only thing I can think to check: did you ensure the jQuery plugin is loaded--does it work if you type that js call into the browser console?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM