O
O
Oleg2016-11-06 23:16:29
Angular
Oleg, 2016-11-06 23:16:29

Why isn't AngularJS fully initialized?

I'm playing with a new project, for which I wrote several automation scripts.
After running all the gulp tasks, the dist folder looks like this:

js/
--vendor.js
--app.js
index.html

All paths in index.html are connected correctly, the angular variable is defined in the Chrome console, i.e. scripts are connected correctly for sure.
The problem is that it is not possible to create a controller or configure via angular.module.('app').config().
Even such a basic construction in index.html does not work
<div ng-app>
<input type="text" ng-model="textVal">
<span>{{textval}}</span>
</div>

What can be wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
fallen_transcer, 2016-11-07
@fallen_transcer

Did you write the ngController declaration in the html file?

<div ng-app>
<div ng-controller='Имя контроллера'>
<input type="text" ng-model="textVal">
<span>{{textval}}</span>
</div>
</div>

Still remembered. angular.module.('app') just returns the module instance. To create a module, use:
angular.module('app',[])
That is, specifying dependencies with a comma creates a module, without specifying - it simply returns an already created module

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question