Comments (4)
It's quite standard practice to reference global variables with window
when using code wrapped in IIFE. Unless of course you want to use it outside of a brower context, but that's not the case here. The reason is that when using window
explicitly, we are sure we're referencing the global angular
instead of some random variable that might have been declared before the IIFE. What do you find odd about it?
from angular-bind-html-compile.
from angular-bind-html-compile.
Still, I don't understand what is wrong with this pattern and why would you like it to be changed?
from angular-bind-html-compile.
First of all, the reference to the - window - object is in the global scope. As there is only one object in the scope chain, which is the Global Object, there's no reason to reference - angular - this way. It's just a pointless (and odd) dot operation.
Second, in the global scope, the - this - object references the Global Object, so you could have used that instead of the - window - host object. There's never a reason to use a host object to reference a global variable; if there were, the language would clearly be broken.
As for wanting it changed, I really don't care. Just thought I'd point out some odd choices in the code. On an unrelated note, it's no longer used in my current project.
from angular-bind-html-compile.
Related Issues (18)
- Selective Compiling via another directive HOT 2
- Allow to retrieve scope as argument
- Include minified version (angular-bind-html-compile.min.js) into bower component HOT 5
- How do you pass a calling scope? I know it's in the bindHtmlScope attr, but how to use it?
- Use with bindonce? HOT 1
- SUGGESTION: Template-url HOT 3
- The directive does not work on iOS cordova app HOT 2
- Not deleting scopes HOT 1
- Submit to npmjs HOT 11
- Support for sending scope HOT 1
- Does not work with ngRepeat HOT 3
- Odd comment doesn't match code logic
- digestion cycle
- Add JSHint, JSCS and grunt tests with travis
- Add contribution and release guidelines
- Recursive use of bind-html-compile request
- bower requirement for angular 1.2 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-bind-html-compile.