简体   繁体   中英

Override NG in angular Js

I know this question seems to be vague initially but I want to override the ng with anything else may be my name.

We can override $ of jquery,

var $j = jQuery.noConflict();

we can override other things by specifying it to variable like

var hello=$http;

And use hello as $http in the whole program.

So my simple question is can we override ng and use something else in html.

No performance issue just curious to know is there anyway to do it.

It's a little old, but there is a solution over here: http://www.mattburkedev.com/multiple-angular-versions-on-the-same-page/

Yes it's possible. Small example using angular as something else and the orignal angular global is now in existingWindowDotAngular.

var existingWindowDotAngular = window.angular;
var angular = 'whatever';

You can't override AngularJS built-in directives. However, you can define multiple directives with the same name and have them executed against the same element. By assigning appropriate priority to your directive, you can then control whether your directive runs before or after a built-in directive.

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