Answer the question
In order to leave comments, you need to log in
Can I use angular to assign a value to a variable in the html page and then work with it in the controller?
Hello.
The question is -
I use angulras to write the following code in html
<body>
{{numb = 10}}
</body>
Answer the question
In order to leave comments, you need to log in
Yes, you can, but it's called... shitcode. In no case should logic be moved from the controller to the template (oh, horror) - only shitcoders do this, it’s like that and nothing else.
Yes, of course, something like this:
<script>
angular
.module('app.data')
.value('numb', 10);
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question