Friday, August 30, 2019

AngularJS Binding Explain

AngularJS has 3 bindings inside a directive. @, =, and &.

@  attribute string binding
 =   two way binding
 &  callback method binding

For @, it is the binding for passing strings. The variables inside the directive's parent scope can pass into the current directive. Using @ looked like the current directive has parameters who was passed by their parent html.

For =, it is the two way model binding, Usually it will be a model which exists both in the current directive's isolated scope and the parent directive's scope. The 2 models are linked together so that any change in one model will be reflected in another model.

For &, it is the methods from the parent scope, so that the current directive can use the method in the parent directive's scope.


https://stackoverflow.com/questions/14050195/what-is-the-difference-between-and-in-directive-scope-in-angularjs

Tuesday, April 23, 2019

Visual Studio Compile error The item "obj\Debug\SampleProject.Forms.MDIMain.resources" was specified more than once in the "Resources" parameter.

When merged develop branch to master branch it could happen that the project file contains repeating items. As result, compiling your visual studio project will have such compile error like:
The item "xxx" was specified more than once in the "Resources" parameter. Duplicate items are not supported by the "Resources" parameter.

The solution is easy:
1. Right click on your project and select "Unload the project"
2. Right click on your project and select "Edit YourProject.csproj"
3. Locate the repeating items and remove them.
4. Reload the project

Then these compile error will be resolved.



Resolve issues while openning old project in Visual Studio 2015/2017

When you opened your old project in Visual studio 2015/2017, you will find a lot of missing packages. When you tried to install any one of those missing packages, the visual studio will warn you that the soltuion is not saved.

How to resolve this?

My easy solution is:

1. Under File, choose save your solution.
2. Open Tools, Nuget Package Manager, Package Manger Console, and enter following command:

Update-Package –reinstall Microsoft.AspNet.Web.Optimization

Note Microsoft.AspNet.Web.Optimization can be any one of your missing package, then all missing package will be reinstalled automatically.

Reference:
https://developercommunity.visualstudio.com/content/problem/40958/update-package-reinstall-forces-all-packages-to-re.html

Thursday, March 28, 2019

How to upload local project from windows to github

First you need to install Git for Windows, once it's done, using Command Prompt and enter following commands:

cd <the folder>
git init
git add .   //for all files under the folder
commit -m "adding files" git remote add origin https://github.com/<your-user-name>/<your-repository-name>.git
git push -u origin master

how-to-upload-a-project-to-github