tm1813
(Tm1813)
March 15, 2014, 2:12pm
1
Hi, I want to ask. AngularJS seems to be the most popular JavaScript framework right now in the market. However, if I declare an AngularJS directive in a YII view page file, for example:
<input type="text" ng-model="variable1">
Then this element in the page will be completely removed Yii. How can I add the Angular directive (ex: ng-model) into a Yii control like:
<?php echo CHtml::hiddenField(‘loginActivation’ , Yii::app()->session[‘loginActivation’],
array('id'=>'loginActivation','class'=>'loginActivation')); ?>
Or, what JavaScript framework is the best fit to Yii? Is it ExtJS? (there is a commercial product as the combined) Is there any other free JavaScript framework at least works with Yii?
Impossible. Yii does not remove elements.
Just like all other properties:
array('id'=>'loginActivation','class'=>'loginActivation', 'ng-model' => ...)); ?>
tm1813
(Tm1813)
March 16, 2014, 6:28am
3
Impossible. Yii does not remove elements.
Just like all other properties:
array('id'=>'loginActivation','class'=>'loginActivation', 'ng-model' => ...)); ?>
Hi, I wish you are right, but… I tried the followings in my login view (you may verify if you don’t believe) it::
<input type="text" ng-model="exist-if-ORey-wrong">
<?php echo CHtml::hiddenField('loginActivation' , Yii::app()->session['loginActivation'],
array('id'=>'loginActivation','class'=>'loginActivation','ng-model'=>'loginActivation')); ?>
However, the generated login page (by view source), I saw only::
<input id="loginActivation" class="loginActivation" type="hidden" name="loginActivation" />
Neither of the above ng-model exists. Yii DID remove them. Why YII touched my source code??!! It made me frustrated!
I tried it. This
<?php echo CHtml::hiddenField('loginActivation' , Yii::app()->session['loginActivation'], array('id'=>'loginActivation','class'=>'loginActivation','ng-model'=>'loginActivation')); ?>
Generates this for me
<input id="loginActivation" class="loginActivation" ng-model="loginActivation" type="hidden" name="loginActivation">
So working as expected.
tm1813
(Tm1813)
March 16, 2014, 1:17pm
5
I tried it. This
<?php echo CHtml::hiddenField('loginActivation' , Yii::app()->session['loginActivation'], array('id'=>'loginActivation','class'=>'loginActivation','ng-model'=>'loginActivation')); ?>
Generates this for me
<input id="loginActivation" class="loginActivation" ng-model="loginActivation" type="hidden" name="loginActivation">
So working as expected.
Oh, sorry I made a mistake, so AngularJS does work with Yii.