All Questions
33 questions
0
votes
1
answer
175
views
Unable to reference latest angular-ui-router package
I'm trying to upgrade an Angular1.4.0 app to use the latest angular-ui-router, but I can't figure out how to reference this package in code. I'm using webpack 1.12.9 and node 6.10.2. I've installed ...
0
votes
1
answer
923
views
import/export issue of angularjs constants
I am using common js module system in my angularjs 1.x application and struggling with importing/exporting constants. This is what I have.
index.js
'use strict';
var angular = require('angular'); ...
0
votes
1
answer
318
views
Relative path not found when requiring a Angular component
Im using Browserify for bundling and Angularjs framework. The scenario is , i have a Angularjs component which has a directive defined as -
var loginDirective = /*@ngInject*/ function(){
return{
...
1
vote
1
answer
299
views
Angular window injecting
Is it possible prevent angular instance inject into global (window) scope when being required and bundled with webpack for example or any other module bundler?
I have found that current main ...
0
votes
1
answer
67
views
Javascript module loaders and critical rendering path
What i understand is, when you use module loaders, your scripts ( modules ) are loaded asynchronously.
The question is If you are manipulating dom, how does the browser / module loader figures out ...
1
vote
2
answers
734
views
Angular 1 and 2 hybrid app - "require is not defined"
I'm trying to upgrade a giant client-side app from Angular 1.x to Angular 2, and I've hit a really annoying roadblock. I've recreated the issue with a dummy, light-weight project (files pasted below),...
3
votes
0
answers
132
views
CommonJS require not working when the module name is dynamic
I have the following code which is working fine
var angular = require("angular");
module.exports = angular
.module('controllers', [])
.controller('Topbar', require('../controllers/Topbar'));
...
0
votes
1
answer
475
views
How to use webpack with js that isn't exported
I'm trying to figure out how to include this javascript with webpack but I'm struggling. I'm installing an angular module called angular-colorthief via npm. I've installed it and included the module ...
1
vote
1
answer
1k
views
Lazy load AngularJS controllers with Webpack
I am using AngularJS 1.5.6 with Webpack.
My files architecture is:
app
|- scripts
| |- modules
| |- homepage
| |- homepage.js
| |- controller
| |- ...
0
votes
1
answer
239
views
jspm + angular 1.5 + ES 5 + require
Is it a good idea to use JSPM with angular 1.5.x and ES 5.
this implies using commonjs module format for dependencies (require(''))
If so how would you do it?
There is not a lot of examples of this.
I ...
0
votes
1
answer
767
views
Using an external HTML template in AngularJS 1.5 component with Webpack and Typescript
I am trying to load an external html file into my Angular component:
import { LoginController } from './login.controller';
import './login.scss';
import './login.html';
class LoginComponent ...
0
votes
2
answers
1k
views
Consume CommonJS Module Angular 2
I'm trying to write a simple Angular 2 application which consumes a CommonJS Node module (Node Yelp). Angular 2 by default uses SystemJS which has the ability to load different module formats.
I ...
2
votes
1
answer
1k
views
What is a good way to include a non-commonJS library to Webpack context?
I want to include an external and non-commonJS library defining an AngularJS module.
What is a proper way to do it since I obviously can't write:
import MyLibrary from 'MyLibraryPath'
angular....
2
votes
1
answer
1k
views
AngularJS modules vs CommonJS/ECMA6 modules
I've joined an ongoing web project with frontend written in Angular 1 as MVC framework and using Webpack as build system and I'm feeling like Neo in MATRIX 2 in a stack of nested matrices.
The ...
1
vote
0
answers
165
views
Can a loader or some function to run in build time to transform string var in a static string to require() param to him stop to work in dynamic mode?
I have this code bellow:
var m = app.getModuleMetadata(__filename);
module.exports = [m.rota, {
url: '/costumer/phone/listar',
templateProvider: function ($q) {
return $q(function (...
4
votes
1
answer
3k
views
Angular + TypeScript + External Modules. How to maintain type information across files?
I'm using Angular 1.4, TypeScript 1.6, and CommonJS external modules.
I have three files in this module:
paginator.module.ts
paginator.service.ts
paginator.controller.ts
paginator.module.ts looks ...
5
votes
2
answers
8k
views
How to write commonjs pattern module of AngularJS
All:
I am pretty new to browserify and commonjs pattern. When I try how broserify work with Angular, I use a very simple Example:
//main.js
require("angular");
var app = angular.module("app", []);
...
2
votes
0
answers
326
views
Import external modules in typescript angular app [duplicate]
I am refactoring a large app to use commonjs instead of a gazzilion script tags. I have refactored all the parts where the main app (entry point) imports the different app modules, app modules entry ...
1
vote
5
answers
127
views
Angular Stormpath Injection Unknown Providor
I'm trying to use the angular ui router with storm path for angular, but I keep getting an unknown provider error. My code is as follows,
var angular = require("angular");
// app.js
var app = ...
3
votes
1
answer
485
views
Browserify with Angular and non-CommonJS libraries
I am trying to convert my Angular project to use CommonJS and Browserify. My issue though is that some of my Angular modules are not in the CommonJS format. What is the best way to include them?
For ...
6
votes
0
answers
1k
views
How to bundle (for browser) typescript external modules, generate d.ts and use in a client application?
I am working on a typescript framework to develop single page application on top of angularjs. As a development practice each class inside the framework has been implemented as separate file which in-...
7
votes
2
answers
292
views
Browserify require('restangular') returns empty object
Im facing a problem when I try to use browserify, angularjs and restangular.
When I try to require the npm or bower module, for example require('restangular), browserify returns empty object. This ...
5
votes
1
answer
2k
views
Webpack is loading module twice
I am using webpack to build my angular.js application.
Given a simple example:
app.js
var angular = require('exports?window.angular!angular'),
angularMoment = require('angular-moment');
angular....
3
votes
1
answer
1k
views
modular angularjs application commonJS vs AMD module syntax
I apologise in advance if the question has been already answered but I haven't been able to find anything relevant.
I'm refactoring a fairly large AngularJS application, I'm creating components in ...
1
vote
1
answer
949
views
Typescript, Browserify and angularjs beyond the two file example
I am trying to move a very large angularjs project written in typescript from AMD to CommonJS.
I have found several examples online, but cannot find an example that would cover a real project ...
3
votes
1
answer
3k
views
How can I injector Angular module in webpack?
I install ngRoute from npm, my webpack default load default.js
webpack.config.js
'use strict';
var path = require('path'),
webpack = require("webpack"),
AngularPlugin = require('angular-...
5
votes
2
answers
1k
views
Is it reasonable to use UMD with no exports, to simply augment a dependency?
I'm creating my first AngularJS module intended for open source distribution. I'd like to package it in a way that's easy for others to consume.
The UMD project provides a pattern for exporting ...
2
votes
1
answer
420
views
Can browserify require a vinyl file generated in gulp?
I've just started using gulp and browserify and I need some help with this problem:
I'm using a lib called ng-autobootstrap to generate a browserify compatible file, which is later on required in the ...
0
votes
0
answers
79
views
Why is angular written twice when requiring it as a Bower component
I've seen this syntax for requiring Bower components (like Angular) into a project:
require('angular/angular');
I'm curious as to why it's written as 'angular/angular' instead of just 'angular'.
...
9
votes
3
answers
7k
views
How to make it possible to use Typescript with SystemJS and Angular?
I'm trying to make SystemJS work with Typescript, but they seem to conflict with each other.
How can I take advantage of the autoloading from System.js without it conflicting with keywords on ...
3
votes
1
answer
2k
views
Angular not updating binding when assigned in promise.then()
In my angular app, I have a $scope variable user with a name.
If I set this variable to "test" on click:
<a href="#" ng-click="setUser()">Set User</a>
with the function
$scope.user = {...
5
votes
2
answers
5k
views
How do I load AMD modules when using Angular JS?
For some strange reason Angular JS has its own module system that is neither AMD nor CommonJS.
I have many existing modules in AMD format. I would like to use them in an Angular app.
I would like ...
10
votes
2
answers
20k
views
Uncaught ReferenceError: require is not defined
For a project that I am working on I have been using a hodgepodge of JavaScript libraries. The main logic of my code is broken down into multiple commonjs modules. I use google closure to combine ...