Answer the question
In order to leave comments, you need to log in
How to pass parameter from page to controller in angular.js?
The question arose of how to most correctly pass a php variable from an already rendered page to the controller without littering the window, Google suggested this option:
angular.element(document).ready(function () {
angular.module('AppName').value('name', {{$someValue}});
angular.bootstrap(document.html, ['AppName']);
});
Answer the question
In order to leave comments, you need to log in
Make a directive and pass data from php to its attribute.
<your-directive param="<?php _значение_параметра_ ?>"></your-directive>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question