Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Extending global angular object - good practice?

$
0
0

@leschirmeur wrote:

Hi there!

In an Ionic project we are extending the global angular object like this:

angular
        .module('demo')
        .config(extendAngular);

function extendAngular() {
    angular.isUndefinedOrNull = function (val) {
        return angular.isUndefined(val) || val === null;
    };

    angular.isCordovaSupported = function () {
        return angular.isDefined(window.cordova);
    };
}

By doing so, we can call angular.isUndefinedOrNull() and angular. isCordovaSupported from anywhere within the app.

Is this a good practice? If not, what would be better approaches to accomplish the same?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>